1. Packages
  2. Rancher2
  3. API Docs
  4. Secret
Rancher 2 v6.1.0 published on Tuesday, Mar 12, 2024 by Pulumi

rancher2.Secret

Explore with Pulumi AI

rancher2 logo
Rancher 2 v6.1.0 published on Tuesday, Mar 12, 2024 by Pulumi

    Provides a Rancher v2 Secret resource. This can be used to create secrets for Rancher v2 environments and retrieve their information.

    Depending of the availability, there are 2 types of Rancher v2 secrets:

    • Project secret: Available to all namespaces in the project_id
    • Namespaced secret: Available to just namespace_id in the project_id

    Create Secret Resource

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

    Constructor syntax

    new Secret(name: string, args: SecretArgs, opts?: CustomResourceOptions);
    @overload
    def Secret(resource_name: str,
               args: SecretArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Secret(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               data: Optional[Mapping[str, Any]] = None,
               project_id: Optional[str] = None,
               annotations: Optional[Mapping[str, Any]] = None,
               description: Optional[str] = None,
               labels: Optional[Mapping[str, Any]] = None,
               name: Optional[str] = None,
               namespace_id: Optional[str] = None)
    func NewSecret(ctx *Context, name string, args SecretArgs, opts ...ResourceOption) (*Secret, error)
    public Secret(string name, SecretArgs args, CustomResourceOptions? opts = null)
    public Secret(String name, SecretArgs args)
    public Secret(String name, SecretArgs args, CustomResourceOptions options)
    
    type: rancher2:Secret
    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 SecretArgs
    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 SecretArgs
    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 SecretArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SecretArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SecretArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var secretResource = new Rancher2.Secret("secretResource", new()
    {
        Data = 
        {
            { "string", "any" },
        },
        ProjectId = "string",
        Annotations = 
        {
            { "string", "any" },
        },
        Description = "string",
        Labels = 
        {
            { "string", "any" },
        },
        Name = "string",
        NamespaceId = "string",
    });
    
    example, err := rancher2.NewSecret(ctx, "secretResource", &rancher2.SecretArgs{
    	Data: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	ProjectId: pulumi.String("string"),
    	Annotations: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	Description: pulumi.String("string"),
    	Labels: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	Name:        pulumi.String("string"),
    	NamespaceId: pulumi.String("string"),
    })
    
    var secretResource = new Secret("secretResource", SecretArgs.builder()        
        .data(Map.of("string", "any"))
        .projectId("string")
        .annotations(Map.of("string", "any"))
        .description("string")
        .labels(Map.of("string", "any"))
        .name("string")
        .namespaceId("string")
        .build());
    
    secret_resource = rancher2.Secret("secretResource",
        data={
            "string": "any",
        },
        project_id="string",
        annotations={
            "string": "any",
        },
        description="string",
        labels={
            "string": "any",
        },
        name="string",
        namespace_id="string")
    
    const secretResource = new rancher2.Secret("secretResource", {
        data: {
            string: "any",
        },
        projectId: "string",
        annotations: {
            string: "any",
        },
        description: "string",
        labels: {
            string: "any",
        },
        name: "string",
        namespaceId: "string",
    });
    
    type: rancher2:Secret
    properties:
        annotations:
            string: any
        data:
            string: any
        description: string
        labels:
            string: any
        name: string
        namespaceId: string
        projectId: string
    

    Secret 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 Secret resource accepts the following input properties:

    Data Dictionary<string, object>
    Secret key/value data. Base64 encoding required for values (map)
    ProjectId string
    The project id where to assign the secret (string)
    Annotations Dictionary<string, object>
    Annotations for secret object (map)
    Description string
    A secret description (string)
    Labels Dictionary<string, object>
    Labels for secret object (map)
    Name string
    The name of the secret (string)
    NamespaceId string
    The namespace id where to assign the namespaced secret (string)
    Data map[string]interface{}
    Secret key/value data. Base64 encoding required for values (map)
    ProjectId string
    The project id where to assign the secret (string)
    Annotations map[string]interface{}
    Annotations for secret object (map)
    Description string
    A secret description (string)
    Labels map[string]interface{}
    Labels for secret object (map)
    Name string
    The name of the secret (string)
    NamespaceId string
    The namespace id where to assign the namespaced secret (string)
    data Map<String,Object>
    Secret key/value data. Base64 encoding required for values (map)
    projectId String
    The project id where to assign the secret (string)
    annotations Map<String,Object>
    Annotations for secret object (map)
    description String
    A secret description (string)
    labels Map<String,Object>
    Labels for secret object (map)
    name String
    The name of the secret (string)
    namespaceId String
    The namespace id where to assign the namespaced secret (string)
    data {[key: string]: any}
    Secret key/value data. Base64 encoding required for values (map)
    projectId string
    The project id where to assign the secret (string)
    annotations {[key: string]: any}
    Annotations for secret object (map)
    description string
    A secret description (string)
    labels {[key: string]: any}
    Labels for secret object (map)
    name string
    The name of the secret (string)
    namespaceId string
    The namespace id where to assign the namespaced secret (string)
    data Mapping[str, Any]
    Secret key/value data. Base64 encoding required for values (map)
    project_id str
    The project id where to assign the secret (string)
    annotations Mapping[str, Any]
    Annotations for secret object (map)
    description str
    A secret description (string)
    labels Mapping[str, Any]
    Labels for secret object (map)
    name str
    The name of the secret (string)
    namespace_id str
    The namespace id where to assign the namespaced secret (string)
    data Map<Any>
    Secret key/value data. Base64 encoding required for values (map)
    projectId String
    The project id where to assign the secret (string)
    annotations Map<Any>
    Annotations for secret object (map)
    description String
    A secret description (string)
    labels Map<Any>
    Labels for secret object (map)
    name String
    The name of the secret (string)
    namespaceId String
    The namespace id where to assign the namespaced secret (string)

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Secret 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 Secret Resource

    Get an existing Secret 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?: SecretState, opts?: CustomResourceOptions): Secret
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            annotations: Optional[Mapping[str, Any]] = None,
            data: Optional[Mapping[str, Any]] = None,
            description: Optional[str] = None,
            labels: Optional[Mapping[str, Any]] = None,
            name: Optional[str] = None,
            namespace_id: Optional[str] = None,
            project_id: Optional[str] = None) -> Secret
    func GetSecret(ctx *Context, name string, id IDInput, state *SecretState, opts ...ResourceOption) (*Secret, error)
    public static Secret Get(string name, Input<string> id, SecretState? state, CustomResourceOptions? opts = null)
    public static Secret get(String name, Output<String> id, SecretState 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:
    Annotations Dictionary<string, object>
    Annotations for secret object (map)
    Data Dictionary<string, object>
    Secret key/value data. Base64 encoding required for values (map)
    Description string
    A secret description (string)
    Labels Dictionary<string, object>
    Labels for secret object (map)
    Name string
    The name of the secret (string)
    NamespaceId string
    The namespace id where to assign the namespaced secret (string)
    ProjectId string
    The project id where to assign the secret (string)
    Annotations map[string]interface{}
    Annotations for secret object (map)
    Data map[string]interface{}
    Secret key/value data. Base64 encoding required for values (map)
    Description string
    A secret description (string)
    Labels map[string]interface{}
    Labels for secret object (map)
    Name string
    The name of the secret (string)
    NamespaceId string
    The namespace id where to assign the namespaced secret (string)
    ProjectId string
    The project id where to assign the secret (string)
    annotations Map<String,Object>
    Annotations for secret object (map)
    data Map<String,Object>
    Secret key/value data. Base64 encoding required for values (map)
    description String
    A secret description (string)
    labels Map<String,Object>
    Labels for secret object (map)
    name String
    The name of the secret (string)
    namespaceId String
    The namespace id where to assign the namespaced secret (string)
    projectId String
    The project id where to assign the secret (string)
    annotations {[key: string]: any}
    Annotations for secret object (map)
    data {[key: string]: any}
    Secret key/value data. Base64 encoding required for values (map)
    description string
    A secret description (string)
    labels {[key: string]: any}
    Labels for secret object (map)
    name string
    The name of the secret (string)
    namespaceId string
    The namespace id where to assign the namespaced secret (string)
    projectId string
    The project id where to assign the secret (string)
    annotations Mapping[str, Any]
    Annotations for secret object (map)
    data Mapping[str, Any]
    Secret key/value data. Base64 encoding required for values (map)
    description str
    A secret description (string)
    labels Mapping[str, Any]
    Labels for secret object (map)
    name str
    The name of the secret (string)
    namespace_id str
    The namespace id where to assign the namespaced secret (string)
    project_id str
    The project id where to assign the secret (string)
    annotations Map<Any>
    Annotations for secret object (map)
    data Map<Any>
    Secret key/value data. Base64 encoding required for values (map)
    description String
    A secret description (string)
    labels Map<Any>
    Labels for secret object (map)
    name String
    The name of the secret (string)
    namespaceId String
    The namespace id where to assign the namespaced secret (string)
    projectId String
    The project id where to assign the secret (string)

    Import

    Secrets can be imported using the secret ID in the format <namespace_id>.<project_id>.<secret_id>

    $ pulumi import rancher2:index/secret:Secret foo &lt;namespace_id&gt;.&lt;project_id&gt;.&lt;secret_id&gt;
    

    <namespace_id> is optional, just needed for namespaced secret.

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

    Package Details

    Repository
    Rancher2 pulumi/pulumi-rancher2
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the rancher2 Terraform Provider.
    rancher2 logo
    Rancher 2 v6.1.0 published on Tuesday, Mar 12, 2024 by Pulumi