1. Packages
  2. Rancher2 Provider
  3. API Docs
  4. SecretV2
Rancher 2 v9.0.0 published on Wednesday, Apr 16, 2025 by Pulumi

rancher2.SecretV2

Explore with Pulumi AI

Provides a Rancher Secret v2 resource. This can be used to create k8s secrets for Rancher v2 environments and retrieve their information. Secret v2 resource is available at Rancher v2.5.x and above.

Create SecretV2 Resource

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

Constructor syntax

new SecretV2(name: string, args: SecretV2Args, opts?: CustomResourceOptions);
@overload
def SecretV2(resource_name: str,
             args: SecretV2Args,
             opts: Optional[ResourceOptions] = None)

@overload
def SecretV2(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             cluster_id: Optional[str] = None,
             data: Optional[Mapping[str, str]] = None,
             annotations: Optional[Mapping[str, str]] = None,
             immutable: Optional[bool] = None,
             labels: Optional[Mapping[str, str]] = None,
             name: Optional[str] = None,
             namespace: Optional[str] = None,
             type: Optional[str] = None)
func NewSecretV2(ctx *Context, name string, args SecretV2Args, opts ...ResourceOption) (*SecretV2, error)
public SecretV2(string name, SecretV2Args args, CustomResourceOptions? opts = null)
public SecretV2(String name, SecretV2Args args)
public SecretV2(String name, SecretV2Args args, CustomResourceOptions options)
type: rancher2:SecretV2
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SecretV2Args
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SecretV2Args
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SecretV2Args
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SecretV2Args
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SecretV2Args
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 secretV2Resource = new Rancher2.SecretV2("secretV2Resource", new()
{
    ClusterId = "string",
    Data = 
    {
        { "string", "string" },
    },
    Annotations = 
    {
        { "string", "string" },
    },
    Immutable = false,
    Labels = 
    {
        { "string", "string" },
    },
    Name = "string",
    Namespace = "string",
    Type = "string",
});
Copy
example, err := rancher2.NewSecretV2(ctx, "secretV2Resource", &rancher2.SecretV2Args{
	ClusterId: pulumi.String("string"),
	Data: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Annotations: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Immutable: pulumi.Bool(false),
	Labels: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Name:      pulumi.String("string"),
	Namespace: pulumi.String("string"),
	Type:      pulumi.String("string"),
})
Copy
var secretV2Resource = new SecretV2("secretV2Resource", SecretV2Args.builder()
    .clusterId("string")
    .data(Map.of("string", "string"))
    .annotations(Map.of("string", "string"))
    .immutable(false)
    .labels(Map.of("string", "string"))
    .name("string")
    .namespace("string")
    .type("string")
    .build());
Copy
secret_v2_resource = rancher2.SecretV2("secretV2Resource",
    cluster_id="string",
    data={
        "string": "string",
    },
    annotations={
        "string": "string",
    },
    immutable=False,
    labels={
        "string": "string",
    },
    name="string",
    namespace="string",
    type="string")
Copy
const secretV2Resource = new rancher2.SecretV2("secretV2Resource", {
    clusterId: "string",
    data: {
        string: "string",
    },
    annotations: {
        string: "string",
    },
    immutable: false,
    labels: {
        string: "string",
    },
    name: "string",
    namespace: "string",
    type: "string",
});
Copy
type: rancher2:SecretV2
properties:
    annotations:
        string: string
    clusterId: string
    data:
        string: string
    immutable: false
    labels:
        string: string
    name: string
    namespace: string
    type: string
Copy

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

ClusterId
This property is required.
Changes to this property will trigger replacement.
string
The cluster id of the secret V2 (string)
Data This property is required. Dictionary<string, string>
The data of the secret v2 (map)
Annotations Dictionary<string, string>
Annotations for the secret v2 (map)
Immutable bool
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
Labels Dictionary<string, string>
Labels for the secret v2 (map)
Name string
The name of the secret v2 (string)
Namespace Changes to this property will trigger replacement. string
The namespaces of the secret v2. Default: default (string)
Type string
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
ClusterId
This property is required.
Changes to this property will trigger replacement.
string
The cluster id of the secret V2 (string)
Data This property is required. map[string]string
The data of the secret v2 (map)
Annotations map[string]string
Annotations for the secret v2 (map)
Immutable bool
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
Labels map[string]string
Labels for the secret v2 (map)
Name string
The name of the secret v2 (string)
Namespace Changes to this property will trigger replacement. string
The namespaces of the secret v2. Default: default (string)
Type string
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
clusterId
This property is required.
Changes to this property will trigger replacement.
String
The cluster id of the secret V2 (string)
data This property is required. Map<String,String>
The data of the secret v2 (map)
annotations Map<String,String>
Annotations for the secret v2 (map)
immutable Boolean
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels Map<String,String>
Labels for the secret v2 (map)
name String
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. String
The namespaces of the secret v2. Default: default (string)
type String
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
clusterId
This property is required.
Changes to this property will trigger replacement.
string
The cluster id of the secret V2 (string)
data This property is required. {[key: string]: string}
The data of the secret v2 (map)
annotations {[key: string]: string}
Annotations for the secret v2 (map)
immutable boolean
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels {[key: string]: string}
Labels for the secret v2 (map)
name string
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. string
The namespaces of the secret v2. Default: default (string)
type string
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
cluster_id
This property is required.
Changes to this property will trigger replacement.
str
The cluster id of the secret V2 (string)
data This property is required. Mapping[str, str]
The data of the secret v2 (map)
annotations Mapping[str, str]
Annotations for the secret v2 (map)
immutable bool
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels Mapping[str, str]
Labels for the secret v2 (map)
name str
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. str
The namespaces of the secret v2. Default: default (string)
type str
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
clusterId
This property is required.
Changes to this property will trigger replacement.
String
The cluster id of the secret V2 (string)
data This property is required. Map<String>
The data of the secret v2 (map)
annotations Map<String>
Annotations for the secret v2 (map)
immutable Boolean
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels Map<String>
Labels for the secret v2 (map)
name String
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. String
The namespaces of the secret v2. Default: default (string)
type String
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
ResourceVersion string
(Computed) The k8s resource version (string)
Id string
The provider-assigned unique ID for this managed resource.
ResourceVersion string
(Computed) The k8s resource version (string)
id String
The provider-assigned unique ID for this managed resource.
resourceVersion String
(Computed) The k8s resource version (string)
id string
The provider-assigned unique ID for this managed resource.
resourceVersion string
(Computed) The k8s resource version (string)
id str
The provider-assigned unique ID for this managed resource.
resource_version str
(Computed) The k8s resource version (string)
id String
The provider-assigned unique ID for this managed resource.
resourceVersion String
(Computed) The k8s resource version (string)

Look up Existing SecretV2 Resource

Get an existing SecretV2 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?: SecretV2State, opts?: CustomResourceOptions): SecretV2
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        annotations: Optional[Mapping[str, str]] = None,
        cluster_id: Optional[str] = None,
        data: Optional[Mapping[str, str]] = None,
        immutable: Optional[bool] = None,
        labels: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        namespace: Optional[str] = None,
        resource_version: Optional[str] = None,
        type: Optional[str] = None) -> SecretV2
func GetSecretV2(ctx *Context, name string, id IDInput, state *SecretV2State, opts ...ResourceOption) (*SecretV2, error)
public static SecretV2 Get(string name, Input<string> id, SecretV2State? state, CustomResourceOptions? opts = null)
public static SecretV2 get(String name, Output<String> id, SecretV2State state, CustomResourceOptions options)
resources:  _:    type: rancher2:SecretV2    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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, string>
Annotations for the secret v2 (map)
ClusterId Changes to this property will trigger replacement. string
The cluster id of the secret V2 (string)
Data Dictionary<string, string>
The data of the secret v2 (map)
Immutable bool
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
Labels Dictionary<string, string>
Labels for the secret v2 (map)
Name string
The name of the secret v2 (string)
Namespace Changes to this property will trigger replacement. string
The namespaces of the secret v2. Default: default (string)
ResourceVersion string
(Computed) The k8s resource version (string)
Type string
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
Annotations map[string]string
Annotations for the secret v2 (map)
ClusterId Changes to this property will trigger replacement. string
The cluster id of the secret V2 (string)
Data map[string]string
The data of the secret v2 (map)
Immutable bool
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
Labels map[string]string
Labels for the secret v2 (map)
Name string
The name of the secret v2 (string)
Namespace Changes to this property will trigger replacement. string
The namespaces of the secret v2. Default: default (string)
ResourceVersion string
(Computed) The k8s resource version (string)
Type string
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
annotations Map<String,String>
Annotations for the secret v2 (map)
clusterId Changes to this property will trigger replacement. String
The cluster id of the secret V2 (string)
data Map<String,String>
The data of the secret v2 (map)
immutable Boolean
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels Map<String,String>
Labels for the secret v2 (map)
name String
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. String
The namespaces of the secret v2. Default: default (string)
resourceVersion String
(Computed) The k8s resource version (string)
type String
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
annotations {[key: string]: string}
Annotations for the secret v2 (map)
clusterId Changes to this property will trigger replacement. string
The cluster id of the secret V2 (string)
data {[key: string]: string}
The data of the secret v2 (map)
immutable boolean
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels {[key: string]: string}
Labels for the secret v2 (map)
name string
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. string
The namespaces of the secret v2. Default: default (string)
resourceVersion string
(Computed) The k8s resource version (string)
type string
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
annotations Mapping[str, str]
Annotations for the secret v2 (map)
cluster_id Changes to this property will trigger replacement. str
The cluster id of the secret V2 (string)
data Mapping[str, str]
The data of the secret v2 (map)
immutable bool
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels Mapping[str, str]
Labels for the secret v2 (map)
name str
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. str
The namespaces of the secret v2. Default: default (string)
resource_version str
(Computed) The k8s resource version (string)
type str
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)
annotations Map<String>
Annotations for the secret v2 (map)
clusterId Changes to this property will trigger replacement. String
The cluster id of the secret V2 (string)
data Map<String>
The data of the secret v2 (map)
immutable Boolean
If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s ImmutableEphemeralVolumes feature gate. Default: false (bool)
labels Map<String>
Labels for the secret v2 (map)
name String
The name of the secret v2 (string)
namespace Changes to this property will trigger replacement. String
The namespaces of the secret v2. Default: default (string)
resourceVersion String
(Computed) The k8s resource version (string)
type String
The type of the k8s secret, used to facilitate programmatic handling of secret data, More info about k8s secret types and expected format. Default: Opaque (string)

Import

V2 secrets can be imported using the Rancher cluster ID, Secret V2 namespace and name.

$ pulumi import rancher2:index/secretV2:SecretV2 foo &lt;CLUSTER_ID&gt;.&lt;SECRET_V2_NAMESPACE&gt;/&lt;SECRET_V2_NAME&gt;
Copy

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.