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

rancher2.Setting

Explore with Pulumi AI

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

On create, if setting already exists, provider will import it and update its value.

On destroy, if setting is a system setting like server-url, provider’ll not delete it from Rancher, it’ll just update setting value to default and remove it from tfstate.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as rancher2 from "@pulumi/rancher2";

// Create a new rancher2 Setting
const foo = new rancher2.Setting("foo", {
    name: "foo",
    value: "<VALUE>",
});
Copy
import pulumi
import pulumi_rancher2 as rancher2

# Create a new rancher2 Setting
foo = rancher2.Setting("foo",
    name="foo",
    value="<VALUE>")
Copy
package main

import (
	"github.com/pulumi/pulumi-rancher2/sdk/v9/go/rancher2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create a new rancher2 Setting
		_, err := rancher2.NewSetting(ctx, "foo", &rancher2.SettingArgs{
			Name:  pulumi.String("foo"),
			Value: pulumi.String("<VALUE>"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Rancher2 = Pulumi.Rancher2;

return await Deployment.RunAsync(() => 
{
    // Create a new rancher2 Setting
    var foo = new Rancher2.Setting("foo", new()
    {
        Name = "foo",
        Value = "<VALUE>",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.rancher2.Setting;
import com.pulumi.rancher2.SettingArgs;
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) {
        // Create a new rancher2 Setting
        var foo = new Setting("foo", SettingArgs.builder()
            .name("foo")
            .value("<VALUE>")
            .build());

    }
}
Copy
resources:
  # Create a new rancher2 Setting
  foo:
    type: rancher2:Setting
    properties:
      name: foo
      value: <VALUE>
Copy

Create Setting Resource

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

Constructor syntax

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

@overload
def Setting(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            value: Optional[str] = None,
            annotations: Optional[Mapping[str, str]] = None,
            labels: Optional[Mapping[str, str]] = None,
            name: Optional[str] = None)
func NewSetting(ctx *Context, name string, args SettingArgs, opts ...ResourceOption) (*Setting, error)
public Setting(string name, SettingArgs args, CustomResourceOptions? opts = null)
public Setting(String name, SettingArgs args)
public Setting(String name, SettingArgs args, CustomResourceOptions options)
type: rancher2:Setting
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. SettingArgs
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. SettingArgs
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. SettingArgs
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. SettingArgs
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. SettingArgs
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 settingResource = new Rancher2.Setting("settingResource", new()
{
    Value = "string",
    Annotations = 
    {
        { "string", "string" },
    },
    Labels = 
    {
        { "string", "string" },
    },
    Name = "string",
});
Copy
example, err := rancher2.NewSetting(ctx, "settingResource", &rancher2.SettingArgs{
	Value: pulumi.String("string"),
	Annotations: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Labels: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Name: pulumi.String("string"),
})
Copy
var settingResource = new Setting("settingResource", SettingArgs.builder()
    .value("string")
    .annotations(Map.of("string", "string"))
    .labels(Map.of("string", "string"))
    .name("string")
    .build());
Copy
setting_resource = rancher2.Setting("settingResource",
    value="string",
    annotations={
        "string": "string",
    },
    labels={
        "string": "string",
    },
    name="string")
Copy
const settingResource = new rancher2.Setting("settingResource", {
    value: "string",
    annotations: {
        string: "string",
    },
    labels: {
        string: "string",
    },
    name: "string",
});
Copy
type: rancher2:Setting
properties:
    annotations:
        string: string
    labels:
        string: string
    name: string
    value: string
Copy

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

Value This property is required. string
The value of the setting (string)
Annotations Dictionary<string, string>
Annotations for setting object (map)
Labels Dictionary<string, string>
Labels for setting object (map)
Name Changes to this property will trigger replacement. string
The name of the setting (string)
Value This property is required. string
The value of the setting (string)
Annotations map[string]string
Annotations for setting object (map)
Labels map[string]string
Labels for setting object (map)
Name Changes to this property will trigger replacement. string
The name of the setting (string)
value This property is required. String
The value of the setting (string)
annotations Map<String,String>
Annotations for setting object (map)
labels Map<String,String>
Labels for setting object (map)
name Changes to this property will trigger replacement. String
The name of the setting (string)
value This property is required. string
The value of the setting (string)
annotations {[key: string]: string}
Annotations for setting object (map)
labels {[key: string]: string}
Labels for setting object (map)
name Changes to this property will trigger replacement. string
The name of the setting (string)
value This property is required. str
The value of the setting (string)
annotations Mapping[str, str]
Annotations for setting object (map)
labels Mapping[str, str]
Labels for setting object (map)
name Changes to this property will trigger replacement. str
The name of the setting (string)
value This property is required. String
The value of the setting (string)
annotations Map<String>
Annotations for setting object (map)
labels Map<String>
Labels for setting object (map)
name Changes to this property will trigger replacement. String
The name of the setting (string)

Outputs

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

Get an existing Setting 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?: SettingState, opts?: CustomResourceOptions): Setting
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        annotations: Optional[Mapping[str, str]] = None,
        labels: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        value: Optional[str] = None) -> Setting
func GetSetting(ctx *Context, name string, id IDInput, state *SettingState, opts ...ResourceOption) (*Setting, error)
public static Setting Get(string name, Input<string> id, SettingState? state, CustomResourceOptions? opts = null)
public static Setting get(String name, Output<String> id, SettingState state, CustomResourceOptions options)
resources:  _:    type: rancher2:Setting    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 setting object (map)
Labels Dictionary<string, string>
Labels for setting object (map)
Name Changes to this property will trigger replacement. string
The name of the setting (string)
Value string
The value of the setting (string)
Annotations map[string]string
Annotations for setting object (map)
Labels map[string]string
Labels for setting object (map)
Name Changes to this property will trigger replacement. string
The name of the setting (string)
Value string
The value of the setting (string)
annotations Map<String,String>
Annotations for setting object (map)
labels Map<String,String>
Labels for setting object (map)
name Changes to this property will trigger replacement. String
The name of the setting (string)
value String
The value of the setting (string)
annotations {[key: string]: string}
Annotations for setting object (map)
labels {[key: string]: string}
Labels for setting object (map)
name Changes to this property will trigger replacement. string
The name of the setting (string)
value string
The value of the setting (string)
annotations Mapping[str, str]
Annotations for setting object (map)
labels Mapping[str, str]
Labels for setting object (map)
name Changes to this property will trigger replacement. str
The name of the setting (string)
value str
The value of the setting (string)
annotations Map<String>
Annotations for setting object (map)
labels Map<String>
Labels for setting object (map)
name Changes to this property will trigger replacement. String
The name of the setting (string)
value String
The value of the setting (string)

Import

Setting can be imported using the Rancher setting ID.

$ pulumi import rancher2:index/setting:Setting foo &lt;setting_id&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.