# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import json
import warnings
import pulumi
import pulumi.runtime
from . import utilities, tables

class StackScript(pulumi.CustomResource):
    created: pulumi.Output[str]
    deployments_active: pulumi.Output[float]
    deployments_total: pulumi.Output[float]
    description: pulumi.Output[str]
    """
    A description for the StackScript.
    """
    images: pulumi.Output[list]
    """
    An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
    """
    is_public: pulumi.Output[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: pulumi.Output[str]
    """
    The StackScript's label is for display purposes only.
    """
    rev_note: pulumi.Output[str]
    """
    This field allows you to add notes for the set of revisions made to this StackScript.
    """
    script: pulumi.Output[str]
    """
    The script to execute when provisioning a new Linode with this StackScript.
    """
    updated: pulumi.Output[str]
    user_defined_fields: pulumi.Output[list]
    user_gravatar_id: pulumi.Output[str]
    username: pulumi.Output[str]
    def __init__(__self__, resource_name, opts=None, description=None, images=None, is_public=None, label=None, rev_note=None, script=None, user_defined_fields=None, __name__=None, __opts__=None):
        """
        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](https://www.linode.com/docs/platform/stackscripts/) and the [Linode APIv4 docs](https://developers.linode.com/api/v4#tag/StackScripts).
        
        The Linode Guide, [Deploy a WordPress Site Using Terraform and Linode StackScripts](https://www.linode.com/docs/applications/configuration-management/deploy-a-wordpress-site-using-terraform-and-linode-stackscripts/), shows how a public StackScript can be used to provision a Linode Instance.   The guide, [Create a Terraform Module](https://www.linode.com/docs/applications/configuration-management/create-terraform-module/), demonstrates StackScript use through a wrapping module.
        
        ## 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.
        
        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] description: A description for the StackScript.
        :param pulumi.Input[list] images: An array of Image IDs representing the Images that this StackScript is compatible for deploying with.
        :param pulumi.Input[bool] is_public: 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*
        :param pulumi.Input[str] label: The StackScript's label is for display purposes only.
        :param pulumi.Input[str] rev_note: This field allows you to add notes for the set of revisions made to this StackScript.
        :param pulumi.Input[str] script: The script to execute when provisioning a new Linode with this StackScript.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if not resource_name:
            raise TypeError('Missing resource name argument (for URN creation)')
        if not isinstance(resource_name, str):
            raise TypeError('Expected resource name to be a string')
        if opts and not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')

        __props__ = dict()

        if description is None:
            raise TypeError("Missing required property 'description'")
        __props__['description'] = description

        if images is None:
            raise TypeError("Missing required property 'images'")
        __props__['images'] = images

        __props__['is_public'] = is_public

        if label is None:
            raise TypeError("Missing required property 'label'")
        __props__['label'] = label

        __props__['rev_note'] = rev_note

        if script is None:
            raise TypeError("Missing required property 'script'")
        __props__['script'] = script

        __props__['user_defined_fields'] = user_defined_fields

        __props__['created'] = None
        __props__['deployments_active'] = None
        __props__['deployments_total'] = None
        __props__['updated'] = None
        __props__['user_gravatar_id'] = None
        __props__['username'] = None

        super(StackScript, __self__).__init__(
            'linode:index/stackScript:StackScript',
            resource_name,
            __props__,
            opts)


    def translate_output_property(self, prop):
        return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

