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
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Lbrlabs.PulumiPackage.Harness;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
var @default = Harness.GetSecretManager.Invoke(new()
{
Default = true,
});
var spotToken = new Harness.EncryptedText("spotToken", new()
{
SecretManagerId = @default.Apply(@default => @default.Apply(getSecretManagerResult => getSecretManagerResult.Id)),
Value = "<SPOT_TOKEN>",
});
var example = new Harness.Cloudprovider.Spot("example", new()
{
AccountId = "<SPOT_ACCOUNT_ID>",
TokenSecretName = spotToken.Name,
});
});
package main
import (
"github.com/lbrlabs/pulumi-harness/sdk/go/harness"
"github.com/lbrlabs/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, "spotToken", &harness.EncryptedTextArgs{
SecretManagerId: *pulumi.String(_default.Id),
Value: pulumi.String("<SPOT_TOKEN>"),
})
if err != nil {
return err
}
_, err = cloudprovider.NewSpot(ctx, "example", &cloudprovider.SpotArgs{
AccountId: pulumi.String("<SPOT_ACCOUNT_ID>"),
TokenSecretName: spotToken.Name,
})
if err != nil {
return err
}
return nil
})
}
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()
.secretManagerId(default_.id())
.value("<SPOT_TOKEN>")
.build());
var example = new Spot("example", SpotArgs.builder()
.accountId("<SPOT_ACCOUNT_ID>")
.tokenSecretName(spotToken.name())
.build());
}
}
import pulumi
import lbrlabs_pulumi_harness as harness
import pulumi_harness as harness
default = harness.get_secret_manager(default=True)
spot_token = harness.EncryptedText("spotToken",
secret_manager_id=default.id,
value="<SPOT_TOKEN>")
example = harness.cloudprovider.Spot("example",
account_id="<SPOT_ACCOUNT_ID>",
token_secret_name=spot_token.name)
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@lbrlabs/pulumi-harness";
import * as harness from "@pulumi/harness";
const default = harness.getSecretManager({
"default": true,
});
const spotToken = new harness.EncryptedText("spotToken", {
secretManagerId: _default.then(_default => _default.id),
value: "<SPOT_TOKEN>",
});
const example = new harness.cloudprovider.Spot("example", {
accountId: "<SPOT_ACCOUNT_ID>",
tokenSecretName: spotToken.name,
});
resources:
spotToken:
type: harness:EncryptedText
properties:
secretManagerId: ${default.id}
value: <SPOT_TOKEN>
example:
type: harness:cloudprovider:Spot
properties:
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)
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
The Spot resource accepts the following input properties:
- Account
Id string - The Spot account ID
- Token
Secret stringName - The name of the Harness secret containing the spot account token
- Name string
- The name of the cloud provider.
- Account
Id string - The Spot account ID
- Token
Secret stringName - The name of the Harness secret containing the spot account token
- Name string
- The name of the cloud provider.
- account
Id String - The Spot account ID
- token
Secret StringName - The name of the Harness secret containing the spot account token
- name String
- The name of the cloud provider.
- account
Id string - The Spot account ID
- token
Secret stringName - 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_ strname - The name of the Harness secret containing the spot account token
- name str
- The name of the cloud provider.
- account
Id String - The Spot account ID
- token
Secret StringName - 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.
- Account
Id string - The Spot account ID
- Name string
- The name of the cloud provider.
- Token
Secret stringName - The name of the Harness secret containing the spot account token
- Account
Id string - The Spot account ID
- Name string
- The name of the cloud provider.
- Token
Secret stringName - The name of the Harness secret containing the spot account token
- account
Id String - The Spot account ID
- name String
- The name of the cloud provider.
- token
Secret StringName - The name of the Harness secret containing the spot account token
- account
Id string - The Spot account ID
- name string
- The name of the cloud provider.
- token
Secret stringName - 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_ strname - The name of the Harness secret containing the spot account token
- account
Id String - The Spot account ID
- name String
- The name of the cloud provider.
- token
Secret StringName - 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 lbrlabs/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harness
Terraform Provider.