1. Packages
  2. Harness Provider
  3. API Docs
  4. cloudprovider
  5. Spot
Harness v0.7.1 published on Saturday, Mar 29, 2025 by Pulumi

harness.cloudprovider.Spot

Explore with Pulumi AI

Resource for creating a Spot cloud provider. This resource uses the config-as-code API’s. When updating the name or path of this resource you should typically also set the create_before_destroy = true lifecycle setting.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";

const _default = harness.getSecretManager({
    "default": true,
});
const spotToken = new harness.EncryptedText("spot_token", {
    name: "spot_token",
    secretManagerId: _default.then(_default => _default.id),
    value: "<SPOT_TOKEN>",
});
const example = new harness.cloudprovider.Spot("example", {
    name: "example",
    accountId: "<SPOT_ACCOUNT_ID>",
    tokenSecretName: spotToken.name,
});
Copy
import pulumi
import pulumi_harness as harness

default = harness.get_secret_manager(default=True)
spot_token = harness.EncryptedText("spot_token",
    name="spot_token",
    secret_manager_id=default.id,
    value="<SPOT_TOKEN>")
example = harness.cloudprovider.Spot("example",
    name="example",
    account_id="<SPOT_ACCOUNT_ID>",
    token_secret_name=spot_token.name)
Copy
package main

import (
	"github.com/pulumi/pulumi-harness/sdk/go/harness"
	"github.com/pulumi/pulumi-harness/sdk/go/harness/cloudprovider"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := harness.GetSecretManager(ctx, &harness.GetSecretManagerArgs{
			Default: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		spotToken, err := harness.NewEncryptedText(ctx, "spot_token", &harness.EncryptedTextArgs{
			Name:            pulumi.String("spot_token"),
			SecretManagerId: pulumi.String(_default.Id),
			Value:           pulumi.String("<SPOT_TOKEN>"),
		})
		if err != nil {
			return err
		}
		_, err = cloudprovider.NewSpot(ctx, "example", &cloudprovider.SpotArgs{
			Name:            pulumi.String("example"),
			AccountId:       pulumi.String("<SPOT_ACCOUNT_ID>"),
			TokenSecretName: spotToken.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;

return await Deployment.RunAsync(() => 
{
    var @default = Harness.GetSecretManager.Invoke(new()
    {
        Default = true,
    });

    var spotToken = new Harness.EncryptedText("spot_token", new()
    {
        Name = "spot_token",
        SecretManagerId = @default.Apply(@default => @default.Apply(getSecretManagerResult => getSecretManagerResult.Id)),
        Value = "<SPOT_TOKEN>",
    });

    var example = new Harness.Cloudprovider.Spot("example", new()
    {
        Name = "example",
        AccountId = "<SPOT_ACCOUNT_ID>",
        TokenSecretName = spotToken.Name,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.HarnessFunctions;
import com.pulumi.harness.inputs.GetSecretManagerArgs;
import com.pulumi.harness.EncryptedText;
import com.pulumi.harness.EncryptedTextArgs;
import com.pulumi.harness.cloudprovider.Spot;
import com.pulumi.harness.cloudprovider.SpotArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var default = HarnessFunctions.getSecretManager(GetSecretManagerArgs.builder()
            .default_(true)
            .build());

        var spotToken = new EncryptedText("spotToken", EncryptedTextArgs.builder()
            .name("spot_token")
            .secretManagerId(default_.id())
            .value("<SPOT_TOKEN>")
            .build());

        var example = new Spot("example", SpotArgs.builder()
            .name("example")
            .accountId("<SPOT_ACCOUNT_ID>")
            .tokenSecretName(spotToken.name())
            .build());

    }
}
Copy
resources:
  spotToken:
    type: harness:EncryptedText
    name: spot_token
    properties:
      name: spot_token
      secretManagerId: ${default.id}
      value: <SPOT_TOKEN>
  example:
    type: harness:cloudprovider:Spot
    properties:
      name: example
      accountId: <SPOT_ACCOUNT_ID>
      tokenSecretName: ${spotToken.name}
variables:
  default:
    fn::invoke:
      function: harness:getSecretManager
      arguments:
        default: true
Copy

Create Spot Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Spot(name: string, args: SpotArgs, opts?: CustomResourceOptions);
@overload
def Spot(resource_name: str,
         args: SpotArgs,
         opts: Optional[ResourceOptions] = None)

@overload
def Spot(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         account_id: Optional[str] = None,
         token_secret_name: Optional[str] = None,
         name: Optional[str] = None)
func NewSpot(ctx *Context, name string, args SpotArgs, opts ...ResourceOption) (*Spot, error)
public Spot(string name, SpotArgs args, CustomResourceOptions? opts = null)
public Spot(String name, SpotArgs args)
public Spot(String name, SpotArgs args, CustomResourceOptions options)
type: harness:cloudprovider:Spot
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SpotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SpotArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SpotArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SpotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SpotArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var spotResource = new Harness.Cloudprovider.Spot("spotResource", new()
{
    AccountId = "string",
    TokenSecretName = "string",
    Name = "string",
});
Copy
example, err := cloudprovider.NewSpot(ctx, "spotResource", &cloudprovider.SpotArgs{
	AccountId:       pulumi.String("string"),
	TokenSecretName: pulumi.String("string"),
	Name:            pulumi.String("string"),
})
Copy
var spotResource = new Spot("spotResource", SpotArgs.builder()
    .accountId("string")
    .tokenSecretName("string")
    .name("string")
    .build());
Copy
spot_resource = harness.cloudprovider.Spot("spotResource",
    account_id="string",
    token_secret_name="string",
    name="string")
Copy
const spotResource = new harness.cloudprovider.Spot("spotResource", {
    accountId: "string",
    tokenSecretName: "string",
    name: "string",
});
Copy
type: harness:cloudprovider:Spot
properties:
    accountId: string
    name: string
    tokenSecretName: string
Copy

Spot Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Spot resource accepts the following input properties:

AccountId This property is required. string
The Spot account ID
TokenSecretName This property is required. string
The name of the Harness secret containing the spot account token
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
AccountId This property is required. string
The Spot account ID
TokenSecretName This property is required. string
The name of the Harness secret containing the spot account token
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
accountId This property is required. String
The Spot account ID
tokenSecretName This property is required. String
The name of the Harness secret containing the spot account token
name Changes to this property will trigger replacement. String
The name of the cloud provider.
accountId This property is required. string
The Spot account ID
tokenSecretName This property is required. string
The name of the Harness secret containing the spot account token
name Changes to this property will trigger replacement. string
The name of the cloud provider.
account_id This property is required. str
The Spot account ID
token_secret_name This property is required. str
The name of the Harness secret containing the spot account token
name Changes to this property will trigger replacement. str
The name of the cloud provider.
accountId This property is required. String
The Spot account ID
tokenSecretName This property is required. String
The name of the Harness secret containing the spot account token
name Changes to this property will trigger replacement. String
The name of the cloud provider.

Outputs

All input properties are implicitly available as output properties. Additionally, the Spot resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Spot Resource

Get an existing Spot resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SpotState, opts?: CustomResourceOptions): Spot
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        name: Optional[str] = None,
        token_secret_name: Optional[str] = None) -> Spot
func GetSpot(ctx *Context, name string, id IDInput, state *SpotState, opts ...ResourceOption) (*Spot, error)
public static Spot Get(string name, Input<string> id, SpotState? state, CustomResourceOptions? opts = null)
public static Spot get(String name, Output<String> id, SpotState state, CustomResourceOptions options)
resources:  _:    type: harness:cloudprovider:Spot    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccountId string
The Spot account ID
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
TokenSecretName string
The name of the Harness secret containing the spot account token
AccountId string
The Spot account ID
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
TokenSecretName string
The name of the Harness secret containing the spot account token
accountId String
The Spot account ID
name Changes to this property will trigger replacement. String
The name of the cloud provider.
tokenSecretName String
The name of the Harness secret containing the spot account token
accountId string
The Spot account ID
name Changes to this property will trigger replacement. string
The name of the cloud provider.
tokenSecretName string
The name of the Harness secret containing the spot account token
account_id str
The Spot account ID
name Changes to this property will trigger replacement. str
The name of the cloud provider.
token_secret_name str
The name of the Harness secret containing the spot account token
accountId String
The Spot account ID
name Changes to this property will trigger replacement. String
The name of the cloud provider.
tokenSecretName String
The name of the Harness secret containing the spot account token

Import

Import using the Harness Spot cloud provider id.

$ pulumi import harness:cloudprovider/spot:Spot example <provider_id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
harness pulumi/pulumi-harness
License
Apache-2.0
Notes
This Pulumi package is based on the harness Terraform Provider.