1. Packages
  2. Juju Provider
  3. API Docs
  4. Credential
juju 0.19.0 published on Wednesday, Apr 30, 2025 by juju

juju.Credential

Explore with Pulumi AI

juju logo
juju 0.19.0 published on Wednesday, Apr 30, 2025 by juju

    A resource that represent a credential for a cloud.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as juju from "@pulumi/juju";
    
    const _this = new juju.Credential("this", {
        attributes: {
            "client-cert": "/srv/cert.crt",
            "client-key": "/srv/cert.key",
            "trust-password": "S0m3P@$w0rd",
        },
        authType: "certificate",
        clouds: [{
            name: "localhost",
        }],
    });
    
    import pulumi
    import pulumi_juju as juju
    
    this = juju.Credential("this",
        attributes={
            "client-cert": "/srv/cert.crt",
            "client-key": "/srv/cert.key",
            "trust-password": "S0m3P@$w0rd",
        },
        auth_type="certificate",
        clouds=[{
            "name": "localhost",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/juju/juju"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := juju.NewCredential(ctx, "this", &juju.CredentialArgs{
    			Attributes: pulumi.StringMap{
    				"client-cert":    pulumi.String("/srv/cert.crt"),
    				"client-key":     pulumi.String("/srv/cert.key"),
    				"trust-password": pulumi.String("S0m3P@$w0rd"),
    			},
    			AuthType: pulumi.String("certificate"),
    			Clouds: juju.CredentialCloudArray{
    				&juju.CredentialCloudArgs{
    					Name: pulumi.String("localhost"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Juju = Pulumi.Juju;
    
    return await Deployment.RunAsync(() => 
    {
        var @this = new Juju.Credential("this", new()
        {
            Attributes = 
            {
                { "client-cert", "/srv/cert.crt" },
                { "client-key", "/srv/cert.key" },
                { "trust-password", "S0m3P@$w0rd" },
            },
            AuthType = "certificate",
            Clouds = new[]
            {
                new Juju.Inputs.CredentialCloudArgs
                {
                    Name = "localhost",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.juju.Credential;
    import com.pulumi.juju.CredentialArgs;
    import com.pulumi.juju.inputs.CredentialCloudArgs;
    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) {
            var this_ = new Credential("this", CredentialArgs.builder()
                .attributes(Map.ofEntries(
                    Map.entry("client-cert", "/srv/cert.crt"),
                    Map.entry("client-key", "/srv/cert.key"),
                    Map.entry("trust-password", "S0m3P@$w0rd")
                ))
                .authType("certificate")
                .clouds(CredentialCloudArgs.builder()
                    .name("localhost")
                    .build())
                .build());
    
        }
    }
    
    resources:
      this:
        type: juju:Credential
        properties:
          attributes:
            client-cert: /srv/cert.crt
            client-key: /srv/cert.key
            trust-password: S0m3P@$w0rd
          authType: certificate
          clouds:
            - name: localhost
    

    Create Credential Resource

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

    Constructor syntax

    new Credential(name: string, args: CredentialArgs, opts?: CustomResourceOptions);
    @overload
    def Credential(resource_name: str,
                   args: CredentialArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def Credential(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   auth_type: Optional[str] = None,
                   attributes: Optional[Mapping[str, str]] = None,
                   client_credential: Optional[bool] = None,
                   clouds: Optional[Sequence[CredentialCloudArgs]] = None,
                   controller_credential: Optional[bool] = None,
                   name: Optional[str] = None)
    func NewCredential(ctx *Context, name string, args CredentialArgs, opts ...ResourceOption) (*Credential, error)
    public Credential(string name, CredentialArgs args, CustomResourceOptions? opts = null)
    public Credential(String name, CredentialArgs args)
    public Credential(String name, CredentialArgs args, CustomResourceOptions options)
    
    type: juju:Credential
    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 CredentialArgs
    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 CredentialArgs
    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 CredentialArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CredentialArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CredentialArgs
    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 credentialResource = new Juju.Credential("credentialResource", new()
    {
        AuthType = "string",
        Attributes = 
        {
            { "string", "string" },
        },
        ClientCredential = false,
        Clouds = new[]
        {
            new Juju.Inputs.CredentialCloudArgs
            {
                Name = "string",
            },
        },
        ControllerCredential = false,
        Name = "string",
    });
    
    example, err := juju.NewCredential(ctx, "credentialResource", &juju.CredentialArgs{
    	AuthType: pulumi.String("string"),
    	Attributes: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	ClientCredential: pulumi.Bool(false),
    	Clouds: juju.CredentialCloudArray{
    		&juju.CredentialCloudArgs{
    			Name: pulumi.String("string"),
    		},
    	},
    	ControllerCredential: pulumi.Bool(false),
    	Name:                 pulumi.String("string"),
    })
    
    var credentialResource = new Credential("credentialResource", CredentialArgs.builder()
        .authType("string")
        .attributes(Map.of("string", "string"))
        .clientCredential(false)
        .clouds(CredentialCloudArgs.builder()
            .name("string")
            .build())
        .controllerCredential(false)
        .name("string")
        .build());
    
    credential_resource = juju.Credential("credentialResource",
        auth_type="string",
        attributes={
            "string": "string",
        },
        client_credential=False,
        clouds=[{
            "name": "string",
        }],
        controller_credential=False,
        name="string")
    
    const credentialResource = new juju.Credential("credentialResource", {
        authType: "string",
        attributes: {
            string: "string",
        },
        clientCredential: false,
        clouds: [{
            name: "string",
        }],
        controllerCredential: false,
        name: "string",
    });
    
    type: juju:Credential
    properties:
        attributes:
            string: string
        authType: string
        clientCredential: false
        clouds:
            - name: string
        controllerCredential: false
        name: string
    

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

    AuthType string
    Credential authorization type.
    Attributes Dictionary<string, string>
    Credential attributes accordingly to the cloud
    ClientCredential bool
    Add credentials to the client.
    Clouds List<CredentialCloud>
    Juju Cloud where the credentials will be used to access.
    ControllerCredential bool
    Add credentials to the controller.
    Name string
    AuthType string
    Credential authorization type.
    Attributes map[string]string
    Credential attributes accordingly to the cloud
    ClientCredential bool
    Add credentials to the client.
    Clouds []CredentialCloudArgs
    Juju Cloud where the credentials will be used to access.
    ControllerCredential bool
    Add credentials to the controller.
    Name string
    authType String
    Credential authorization type.
    attributes Map<String,String>
    Credential attributes accordingly to the cloud
    clientCredential Boolean
    Add credentials to the client.
    clouds List<CredentialCloud>
    Juju Cloud where the credentials will be used to access.
    controllerCredential Boolean
    Add credentials to the controller.
    name String
    authType string
    Credential authorization type.
    attributes {[key: string]: string}
    Credential attributes accordingly to the cloud
    clientCredential boolean
    Add credentials to the client.
    clouds CredentialCloud[]
    Juju Cloud where the credentials will be used to access.
    controllerCredential boolean
    Add credentials to the controller.
    name string
    auth_type str
    Credential authorization type.
    attributes Mapping[str, str]
    Credential attributes accordingly to the cloud
    client_credential bool
    Add credentials to the client.
    clouds Sequence[CredentialCloudArgs]
    Juju Cloud where the credentials will be used to access.
    controller_credential bool
    Add credentials to the controller.
    name str
    authType String
    Credential authorization type.
    attributes Map<String>
    Credential attributes accordingly to the cloud
    clientCredential Boolean
    Add credentials to the client.
    clouds List<Property Map>
    Juju Cloud where the credentials will be used to access.
    controllerCredential Boolean
    Add credentials to the controller.
    name String

    Outputs

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

    Get an existing Credential 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?: CredentialState, opts?: CustomResourceOptions): Credential
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            attributes: Optional[Mapping[str, str]] = None,
            auth_type: Optional[str] = None,
            client_credential: Optional[bool] = None,
            clouds: Optional[Sequence[CredentialCloudArgs]] = None,
            controller_credential: Optional[bool] = None,
            name: Optional[str] = None) -> Credential
    func GetCredential(ctx *Context, name string, id IDInput, state *CredentialState, opts ...ResourceOption) (*Credential, error)
    public static Credential Get(string name, Input<string> id, CredentialState? state, CustomResourceOptions? opts = null)
    public static Credential get(String name, Output<String> id, CredentialState state, CustomResourceOptions options)
    resources:  _:    type: juju:Credential    get:      id: ${id}
    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:
    Attributes Dictionary<string, string>
    Credential attributes accordingly to the cloud
    AuthType string
    Credential authorization type.
    ClientCredential bool
    Add credentials to the client.
    Clouds List<CredentialCloud>
    Juju Cloud where the credentials will be used to access.
    ControllerCredential bool
    Add credentials to the controller.
    Name string
    Attributes map[string]string
    Credential attributes accordingly to the cloud
    AuthType string
    Credential authorization type.
    ClientCredential bool
    Add credentials to the client.
    Clouds []CredentialCloudArgs
    Juju Cloud where the credentials will be used to access.
    ControllerCredential bool
    Add credentials to the controller.
    Name string
    attributes Map<String,String>
    Credential attributes accordingly to the cloud
    authType String
    Credential authorization type.
    clientCredential Boolean
    Add credentials to the client.
    clouds List<CredentialCloud>
    Juju Cloud where the credentials will be used to access.
    controllerCredential Boolean
    Add credentials to the controller.
    name String
    attributes {[key: string]: string}
    Credential attributes accordingly to the cloud
    authType string
    Credential authorization type.
    clientCredential boolean
    Add credentials to the client.
    clouds CredentialCloud[]
    Juju Cloud where the credentials will be used to access.
    controllerCredential boolean
    Add credentials to the controller.
    name string
    attributes Mapping[str, str]
    Credential attributes accordingly to the cloud
    auth_type str
    Credential authorization type.
    client_credential bool
    Add credentials to the client.
    clouds Sequence[CredentialCloudArgs]
    Juju Cloud where the credentials will be used to access.
    controller_credential bool
    Add credentials to the controller.
    name str
    attributes Map<String>
    Credential attributes accordingly to the cloud
    authType String
    Credential authorization type.
    clientCredential Boolean
    Add credentials to the client.
    clouds List<Property Map>
    Juju Cloud where the credentials will be used to access.
    controllerCredential Boolean
    Add credentials to the controller.
    name String

    Supporting Types

    CredentialCloud, CredentialCloudArgs

    Name string
    The name of the cloud
    Name string
    The name of the cloud
    name String
    The name of the cloud
    name string
    The name of the cloud
    name str
    The name of the cloud
    name String
    The name of the cloud

    Import

    Credentials can be imported by using the following pattern:

    credentialname:cloudname:false:true

    Where false means that is not a client credential

    and true means that is a Controller credential

    $ pulumi import juju:index/credential:Credential credential creddev:localhost:false:true
    

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

    Package Details

    Repository
    juju juju/terraform-provider-juju
    License
    Notes
    This Pulumi package is based on the juju Terraform Provider.
    juju logo
    juju 0.19.0 published on Wednesday, Apr 30, 2025 by juju