StackScript

Provides a Linode StackScript resource. This can be used to create, modify, and delete Linode StackScripts. StackScripts are private or public managed scripts which run within an instance during startup. StackScripts can include variables whose values are specified when the Instance is created.

For more information, see Automate Deployment with StackScripts and the Linode APIv4 docs.

Attributes

This resource exports the following attributes:

  • deployments_active - Count of currently active, deployed Linodes created from this StackScript.

  • user_gravatar_id - The Gravatar ID for the User who created the StackScript.

  • deployments_total - The total number of times this StackScript has been deployed.

  • username - The User who created the StackScript.

  • created - The date this StackScript was created.

  • updated - The date this StackScript was updated.

  • user_defined_fields - This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.

    • label - A human-readable label for the field that will serve as the input prompt for entering the value during deployment.

    • name - The name of the field.

    • example - An example value for the field.

    • one_of - A list of acceptable single values for the field.

    • many_of - A list of acceptable values for the field in any quantity, combination or order.

    • default - The default value. If not specified, this value will be used.

Example Usage

using Pulumi;
using Linode = Pulumi.Linode;

class MyStack : Stack
{
    public MyStack()
    {
        var fooStackScript = new Linode.StackScript("fooStackScript", new Linode.StackScriptArgs
        {
            Label = "foo",
            Description = "Installs a Package",
            Script = @"#!/bin/bash
# <UDF name=""package"" label=""System Package to Install"" example=""nginx"" default="""">
apt-get -q update && apt-get -q -y install $PACKAGE
",
            Images = 
            {
                "linode/ubuntu18.04",
                "linode/ubuntu16.04lts",
            },
            RevNote = "initial version",
        });
        var fooInstance = new Linode.Instance("fooInstance", new Linode.InstanceArgs
        {
            Image = "linode/ubuntu18.04",
            Label = "foo",
            Region = "us-east",
            Type = "g6-nanode-1",
            AuthorizedKeys = 
            {
                "...",
            },
            RootPass = "...",
            StackscriptId = fooStackScript.Id,
            StackscriptData = 
            {
                { "package", "nginx" },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-linode/sdk/v3/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		fooStackScript, err := linode.NewStackScript(ctx, "fooStackScript", &linode.StackScriptArgs{
			Label:       pulumi.String("foo"),
			Description: pulumi.String("Installs a Package"),
			Script:      pulumi.String(fmt.Sprintf("%v%v%v%v%v", "#!/bin/bash\n", "# <UDF name=\"package\" label=\"System Package to Install\" example=\"nginx\" default=\"\">\n", "apt-get -q update && apt-get -q -y install ", "$", "PACKAGE\n")),
			Images: pulumi.StringArray{
				pulumi.String("linode/ubuntu18.04"),
				pulumi.String("linode/ubuntu16.04lts"),
			},
			RevNote: pulumi.String("initial version"),
		})
		if err != nil {
			return err
		}
		_, err = linode.NewInstance(ctx, "fooInstance", &linode.InstanceArgs{
			Image:  pulumi.String("linode/ubuntu18.04"),
			Label:  pulumi.String("foo"),
			Region: pulumi.String("us-east"),
			Type:   pulumi.String("g6-nanode-1"),
			AuthorizedKeys: pulumi.StringArray{
				pulumi.String("..."),
			},
			RootPass:      pulumi.String("..."),
			StackscriptId: fooStackScript.ID(),
			StackscriptData: pulumi.StringMap{
				"package": pulumi.String("nginx"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_linode as linode

foo_stack_script = linode.StackScript("fooStackScript",
    label="foo",
    description="Installs a Package",
    script="""#!/bin/bash
# <UDF name="package" label="System Package to Install" example="nginx" default="">
apt-get -q update && apt-get -q -y install $PACKAGE
""",
    images=[
        "linode/ubuntu18.04",
        "linode/ubuntu16.04lts",
    ],
    rev_note="initial version")
foo_instance = linode.Instance("fooInstance",
    image="linode/ubuntu18.04",
    label="foo",
    region="us-east",
    type="g6-nanode-1",
    authorized_keys=["..."],
    root_pass="...",
    stackscript_id=foo_stack_script.id,
    stackscript_data={
        "package": "nginx",
    })
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";

const fooStackScript = new linode.StackScript("fooStackScript", {
    label: "foo",
    description: "Installs a Package",
    script: `#!/bin/bash
# <UDF name="package" label="System Package to Install" example="nginx" default="">
apt-get -q update && apt-get -q -y install $PACKAGE
`,
    images: [
        "linode/ubuntu18.04",
        "linode/ubuntu16.04lts",
    ],
    revNote: "initial version",
});
const fooInstance = new linode.Instance("fooInstance", {
    image: "linode/ubuntu18.04",
    label: "foo",
    region: "us-east",
    type: "g6-nanode-1",
    authorizedKeys: ["..."],
    rootPass: "...",
    stackscriptId: fooStackScript.id,
    stackscriptData: {
        "package": "nginx",
    },
});

Create a StackScript Resource

new StackScript(name: string, args: StackScriptArgs, opts?: CustomResourceOptions);
@overload
def StackScript(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                description: Optional[str] = None,
                images: Optional[Sequence[str]] = None,
                is_public: Optional[bool] = None,
                label: Optional[str] = None,
                rev_note: Optional[str] = None,
                script: Optional[str] = None,
                user_defined_fields: Optional[Sequence[StackScriptUserDefinedFieldArgs]] = None)
@overload
def StackScript(resource_name: str,
                args: StackScriptArgs,
                opts: Optional[ResourceOptions] = None)
func NewStackScript(ctx *Context, name string, args StackScriptArgs, opts ...ResourceOption) (*StackScript, error)
public StackScript(string name, StackScriptArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args StackScriptArgs
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 StackScriptArgs
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 StackScriptArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args StackScriptArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

StackScript Resource Properties

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

Inputs

The StackScript resource accepts the following input properties:

Description string
A description for the StackScript.
Images List<string>
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
Label string
The StackScript’s label is for display purposes only.
Script string
The script to execute when provisioning a new Linode with this StackScript.
IsPublic bool
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
RevNote string
This field allows you to add notes for the set of revisions made to this StackScript.
UserDefinedFields List<StackScriptUserDefinedFieldArgs>
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.
Description string
A description for the StackScript.
Images []string
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
Label string
The StackScript’s label is for display purposes only.
Script string
The script to execute when provisioning a new Linode with this StackScript.
IsPublic bool
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
RevNote string
This field allows you to add notes for the set of revisions made to this StackScript.
UserDefinedFields []StackScriptUserDefinedFieldArgs
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.
description string
A description for the StackScript.
images string[]
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
label string
The StackScript’s label is for display purposes only.
script string
The script to execute when provisioning a new Linode with this StackScript.
isPublic boolean
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
revNote string
This field allows you to add notes for the set of revisions made to this StackScript.
userDefinedFields StackScriptUserDefinedFieldArgs[]
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.
description str
A description for the StackScript.
images Sequence[str]
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
label str
The StackScript’s label is for display purposes only.
script str
The script to execute when provisioning a new Linode with this StackScript.
is_public bool
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
rev_note str
This field allows you to add notes for the set of revisions made to this StackScript.
user_defined_fields Sequence[StackScriptUserDefinedFieldArgs]
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.

Outputs

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

Created string
The date this StackScript was created.
DeploymentsActive int
Count of currently active, deployed Linodes created from this StackScript.
DeploymentsTotal int
The total number of times this StackScript has been deployed.
Id string
The provider-assigned unique ID for this managed resource.
Updated string
The date this StackScript was updated.
UserGravatarId string
The Gravatar ID for the User who created the StackScript.
Username string
The User who created the StackScript.
Created string
The date this StackScript was created.
DeploymentsActive int
Count of currently active, deployed Linodes created from this StackScript.
DeploymentsTotal int
The total number of times this StackScript has been deployed.
Id string
The provider-assigned unique ID for this managed resource.
Updated string
The date this StackScript was updated.
UserGravatarId string
The Gravatar ID for the User who created the StackScript.
Username string
The User who created the StackScript.
created string
The date this StackScript was created.
deploymentsActive number
Count of currently active, deployed Linodes created from this StackScript.
deploymentsTotal number
The total number of times this StackScript has been deployed.
id string
The provider-assigned unique ID for this managed resource.
updated string
The date this StackScript was updated.
userGravatarId string
The Gravatar ID for the User who created the StackScript.
username string
The User who created the StackScript.
created str
The date this StackScript was created.
deployments_active int
Count of currently active, deployed Linodes created from this StackScript.
deployments_total int
The total number of times this StackScript has been deployed.
id str
The provider-assigned unique ID for this managed resource.
updated str
The date this StackScript was updated.
user_gravatar_id str
The Gravatar ID for the User who created the StackScript.
username str
The User who created the StackScript.

Look up an Existing StackScript Resource

Get an existing StackScript 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?: StackScriptState, opts?: CustomResourceOptions): StackScript
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created: Optional[str] = None,
        deployments_active: Optional[int] = None,
        deployments_total: Optional[int] = None,
        description: Optional[str] = None,
        images: Optional[Sequence[str]] = None,
        is_public: Optional[bool] = None,
        label: Optional[str] = None,
        rev_note: Optional[str] = None,
        script: Optional[str] = None,
        updated: Optional[str] = None,
        user_defined_fields: Optional[Sequence[StackScriptUserDefinedFieldArgs]] = None,
        user_gravatar_id: Optional[str] = None,
        username: Optional[str] = None) -> StackScript
func GetStackScript(ctx *Context, name string, id IDInput, state *StackScriptState, opts ...ResourceOption) (*StackScript, error)
public static StackScript Get(string name, Input<string> id, StackScriptState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Created string
The date this StackScript was created.
DeploymentsActive int
Count of currently active, deployed Linodes created from this StackScript.
DeploymentsTotal int
The total number of times this StackScript has been deployed.
Description string
A description for the StackScript.
Images List<string>
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
IsPublic bool
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
Label string
The StackScript’s label is for display purposes only.
RevNote string
This field allows you to add notes for the set of revisions made to this StackScript.
Script string
The script to execute when provisioning a new Linode with this StackScript.
Updated string
The date this StackScript was updated.
UserDefinedFields List<StackScriptUserDefinedFieldArgs>
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.
UserGravatarId string
The Gravatar ID for the User who created the StackScript.
Username string
The User who created the StackScript.
Created string
The date this StackScript was created.
DeploymentsActive int
Count of currently active, deployed Linodes created from this StackScript.
DeploymentsTotal int
The total number of times this StackScript has been deployed.
Description string
A description for the StackScript.
Images []string
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
IsPublic bool
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
Label string
The StackScript’s label is for display purposes only.
RevNote string
This field allows you to add notes for the set of revisions made to this StackScript.
Script string
The script to execute when provisioning a new Linode with this StackScript.
Updated string
The date this StackScript was updated.
UserDefinedFields []StackScriptUserDefinedFieldArgs
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.
UserGravatarId string
The Gravatar ID for the User who created the StackScript.
Username string
The User who created the StackScript.
created string
The date this StackScript was created.
deploymentsActive number
Count of currently active, deployed Linodes created from this StackScript.
deploymentsTotal number
The total number of times this StackScript has been deployed.
description string
A description for the StackScript.
images string[]
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
isPublic boolean
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
label string
The StackScript’s label is for display purposes only.
revNote string
This field allows you to add notes for the set of revisions made to this StackScript.
script string
The script to execute when provisioning a new Linode with this StackScript.
updated string
The date this StackScript was updated.
userDefinedFields StackScriptUserDefinedFieldArgs[]
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.
userGravatarId string
The Gravatar ID for the User who created the StackScript.
username string
The User who created the StackScript.
created str
The date this StackScript was created.
deployments_active int
Count of currently active, deployed Linodes created from this StackScript.
deployments_total int
The total number of times this StackScript has been deployed.
description str
A description for the StackScript.
images Sequence[str]
An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
is_public bool
This determines whether other users can use your StackScript. Once a StackScript is made public, it cannot be made private. Changing is_public forces the creation of a new StackScript
label str
The StackScript’s label is for display purposes only.
rev_note str
This field allows you to add notes for the set of revisions made to this StackScript.
script str
The script to execute when provisioning a new Linode with this StackScript.
updated str
The date this StackScript was updated.
user_defined_fields Sequence[StackScriptUserDefinedFieldArgs]
This is a list of fields defined with a special syntax inside this StackScript that allow for supplying customized parameters during deployment.
user_gravatar_id str
The Gravatar ID for the User who created the StackScript.
username str
The User who created the StackScript.

Supporting Types

StackScriptUserDefinedField

Default string
Example string
Label string
The StackScript’s label is for display purposes only.
ManyOf string
Name string
OneOf string
Default string
Example string
Label string
The StackScript’s label is for display purposes only.
ManyOf string
Name string
OneOf string
default string
example string
label string
The StackScript’s label is for display purposes only.
manyOf string
name string
oneOf string
default str
example str
label str
The StackScript’s label is for display purposes only.
many_of str
name str
one_of str

Import

Linodes StackScripts can be imported using the Linode StackScript id, e.g.

 $ pulumi import linode:index/stackScript:StackScript mystackscript 1234567

Package Details

Repository
https://github.com/pulumi/pulumi-linode
License
Apache-2.0
Notes
This Pulumi package is based on the linode Terraform Provider.