1. Packages
  2. Rancher2 Provider
Rancher 2 v7.1.1 published on Monday, Oct 7, 2024 by Pulumi

Rancher2 Provider

rancher2 logo
Rancher 2 v7.1.1 published on Monday, Oct 7, 2024 by Pulumi

    Installation

    The rancher2 provider is available as a package in all Pulumi languages:

    Overview

    The Rancher2 provider is used to interact with the resources supported by Rancher v2.

    The provider can be configured in 2 modes:

    • Admin: this is the default mode, intended to manage rancher2 resources. It should be configured with the apiUrl of the Rancher server and API credentials, tokenKey or accessKey and secretKey.
    • Bootstrap: this mode is intended to bootstrap a rancher2 system. It is enabled if bootstrap = true. In this mode, tokenKey or accessKey and secretKey can not be provided. More info at rancher2.Bootstrap resource

    Example Usage

    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: nodejs
    config:
        rancher2:accessKey:
            value: 'TODO: var.rancher2_access_key'
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:secretKey:
            value: 'TODO: var.rancher2_secret_key'
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: python
    config:
        rancher2:accessKey:
            value: 'TODO: var.rancher2_access_key'
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:secretKey:
            value: 'TODO: var.rancher2_secret_key'
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: dotnet
    config:
        rancher2:accessKey:
            value: 'TODO: var.rancher2_access_key'
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:secretKey:
            value: 'TODO: var.rancher2_secret_key'
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: go
    config:
        rancher2:accessKey:
            value: 'TODO: var.rancher2_access_key'
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:secretKey:
            value: 'TODO: var.rancher2_secret_key'
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: yaml
    config:
        rancher2:accessKey:
            value: 'TODO: var.rancher2_access_key'
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:secretKey:
            value: 'TODO: var.rancher2_secret_key'
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: java
    config:
        rancher2:accessKey:
            value: 'TODO: var.rancher2_access_key'
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:secretKey:
            value: 'TODO: var.rancher2_secret_key'
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: nodejs
    config:
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:bootstrap:
            value: true
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: python
    config:
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:bootstrap:
            value: true
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: dotnet
    config:
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:bootstrap:
            value: true
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: go
    config:
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:bootstrap:
            value: true
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: yaml
    config:
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:bootstrap:
            value: true
    
    # Pulumi.yaml provider configuration file
    name: configuration-example
    runtime: java
    config:
        rancher2:apiUrl:
            value: https://rancher.my-domain.com
        rancher2:bootstrap:
            value: true
    
    import * as pulumi from "@pulumi/pulumi";
    import * as rancher2 from "@pulumi/rancher2";
    
    // Create a new rancher2_bootstrap using bootstrap provider config
    const admin = new rancher2.Bootstrap("admin", {
        password: "blahblah",
        telemetry: true,
    });
    // Create a new rancher2 resource using admin provider config
    const foo = new rancher2.Catalog("foo", {
        name: "test",
        url: "http://foo.com:8080",
    });
    
    import pulumi
    import pulumi_rancher2 as rancher2
    
    # Create a new rancher2_bootstrap using bootstrap provider config
    admin = rancher2.Bootstrap("admin",
        password="blahblah",
        telemetry=True)
    # Create a new rancher2 resource using admin provider config
    foo = rancher2.Catalog("foo",
        name="test",
        url="http://foo.com:8080")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Rancher2 = Pulumi.Rancher2;
    
    return await Deployment.RunAsync(() =>
    {
        // Create a new rancher2_bootstrap using bootstrap provider config
        var admin = new Rancher2.Bootstrap("admin", new()
        {
            Password = "blahblah",
            Telemetry = true,
        });
    
        // Create a new rancher2 resource using admin provider config
        var foo = new Rancher2.Catalog("foo", new()
        {
            Name = "test",
            Url = "http://foo.com:8080",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-rancher2/sdk/v7/go/rancher2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a new rancher2_bootstrap using bootstrap provider config
    		_, err := rancher2.NewBootstrap(ctx, "admin", &rancher2.BootstrapArgs{
    			Password:  pulumi.String("blahblah"),
    			Telemetry: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		// Create a new rancher2 resource using admin provider config
    		_, err = rancher2.NewCatalog(ctx, "foo", &rancher2.CatalogArgs{
    			Name: pulumi.String("test"),
    			Url:  pulumi.String("http://foo.com:8080"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    resources:
      # Create a new rancher2_bootstrap using bootstrap provider config
      admin:
        type: rancher2:Bootstrap
        properties:
          password: blahblah
          telemetry: true
      # Create a new rancher2 resource using admin provider config
      foo:
        type: rancher2:Catalog
        properties:
          name: test
          url: http://foo.com:8080
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.rancher2.Bootstrap;
    import com.pulumi.rancher2.BootstrapArgs;
    import com.pulumi.rancher2.Catalog;
    import com.pulumi.rancher2.CatalogArgs;
    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_bootstrap using bootstrap provider config
            var admin = new Bootstrap("admin", BootstrapArgs.builder()
                .password("blahblah")
                .telemetry(true)
                .build());
    
            // Create a new rancher2 resource using admin provider config
            var foo = new Catalog("foo", CatalogArgs.builder()
                .name("test")
                .url("http://foo.com:8080")
                .build());
    
        }
    }
    

    Configuration Reference

    The following configuration inputs are supported:

    • apiUrl - (Required) Rancher API url. It must be provided, but it can also be sourced from the RANCHER_URL environment variable.
    • accessKey - (Optional/Sensitive) Rancher API access key to connect to rancher. It can also be sourced from the RANCHER_ACCESS_KEY environment variable.
    • secretKey - (Optional/Sensitive) Rancher API secret key to connect to rancher. It can also be sourced from the RANCHER_SECRET_KEY environment variable.
    • tokenKey - (Optional/Sensitive) Rancher API token key to connect to rancher. It can also be sourced from the RANCHER_TOKEN_KEY environment variable. Could be used instead accessKey and secretKey.
    • caCerts - CA certificates used to sign Rancher server tls certificates. Mandatory if self signed tls and insecure option false. It can also be sourced from the RANCHER_CA_CERTS environment variable.
    • insecure - (Optional) Allow insecure connection to Rancher. Mandatory if self signed tls and not caCerts provided. It can also be sourced from the RANCHER_INSECURE environment variable.
    • bootstrap - (Optional) Enable bootstrap mode to manage rancher2.Bootstrap resource. It can also be sourced from the RANCHER_BOOTSTRAP environment variable. Default: false
    • retries - (Deprecated) Use timeout instead
    • timeout - (Optional) Timeout duration to retry for Rancher connectivity and resource operations. Default: "120s"
    rancher2 logo
    Rancher 2 v7.1.1 published on Monday, Oct 7, 2024 by Pulumi