1. Packages
  2. Harness Provider
  3. API Docs
  4. cloudprovider
  5. Spot
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

harness.cloudprovider.Spot

Explore with Pulumi AI

harness logo
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

    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,
    });
    
    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)
    
    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
    	})
    }
    
    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,
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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 string
    The unique name of the resource.
    args SpotArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args SpotArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SpotArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args 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",
    });
    
    example, err := cloudprovider.NewSpot(ctx, "spotResource", &cloudprovider.SpotArgs{
    	AccountId:       pulumi.String("string"),
    	TokenSecretName: pulumi.String("string"),
    	Name:            pulumi.String("string"),
    })
    
    var spotResource = new Spot("spotResource", SpotArgs.builder()
        .accountId("string")
        .tokenSecretName("string")
        .name("string")
        .build());
    
    spot_resource = harness.cloudprovider.Spot("spotResource",
        account_id="string",
        token_secret_name="string",
        name="string")
    
    const spotResource = new harness.cloudprovider.Spot("spotResource", {
        accountId: "string",
        tokenSecretName: "string",
        name: "string",
    });
    
    type: harness:cloudprovider:Spot
    properties:
        accountId: string
        name: string
        tokenSecretName: string
    

    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 string
    The Spot account ID
    TokenSecretName string
    The name of the Harness secret containing the spot account token
    Name string
    The name of the cloud provider.
    AccountId string
    The Spot account ID
    TokenSecretName string
    The name of the Harness secret containing the spot account token
    Name string
    The name of the cloud provider.
    accountId String
    The Spot account ID
    tokenSecretName String
    The name of the Harness secret containing the spot account token
    name String
    The name of the cloud provider.
    accountId string
    The Spot account ID
    tokenSecretName string
    The name of the Harness secret containing the spot account token
    name string
    The name of the cloud provider.
    account_id str
    The Spot account ID
    token_secret_name str
    The name of the Harness secret containing the spot account token
    name str
    The name of the cloud provider.
    accountId String
    The Spot account ID
    tokenSecretName String
    The name of the Harness secret containing the spot account token
    name 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)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 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 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 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 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 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 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>
    

    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.
    harness logo
    Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi