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

juju.Model

Explore with Pulumi AI

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

    A resource that represent a Juju Model.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as juju from "@pulumi/juju";
    
    const _this = new juju.Model("this", {
        clouds: [{
            name: "aws",
            region: "eu-west-1",
        }],
        config: {
            development: "true",
            "logging-config": "<root>=INFO",
            "no-proxy": "jujucharms.com",
            "update-status-hook-interval": "5m",
        },
    });
    
    import pulumi
    import pulumi_juju as juju
    
    this = juju.Model("this",
        clouds=[{
            "name": "aws",
            "region": "eu-west-1",
        }],
        config={
            "development": "true",
            "logging-config": "<root>=INFO",
            "no-proxy": "jujucharms.com",
            "update-status-hook-interval": "5m",
        })
    
    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.NewModel(ctx, "this", &juju.ModelArgs{
    			Clouds: juju.ModelCloudArray{
    				&juju.ModelCloudArgs{
    					Name:   pulumi.String("aws"),
    					Region: pulumi.String("eu-west-1"),
    				},
    			},
    			Config: pulumi.StringMap{
    				"development":                 pulumi.String("true"),
    				"logging-config":              pulumi.String("<root>=INFO"),
    				"no-proxy":                    pulumi.String("jujucharms.com"),
    				"update-status-hook-interval": pulumi.String("5m"),
    			},
    		})
    		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.Model("this", new()
        {
            Clouds = new[]
            {
                new Juju.Inputs.ModelCloudArgs
                {
                    Name = "aws",
                    Region = "eu-west-1",
                },
            },
            Config = 
            {
                { "development", "true" },
                { "logging-config", "<root>=INFO" },
                { "no-proxy", "jujucharms.com" },
                { "update-status-hook-interval", "5m" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.juju.Model;
    import com.pulumi.juju.ModelArgs;
    import com.pulumi.juju.inputs.ModelCloudArgs;
    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 Model("this", ModelArgs.builder()
                .clouds(ModelCloudArgs.builder()
                    .name("aws")
                    .region("eu-west-1")
                    .build())
                .config(Map.ofEntries(
                    Map.entry("development", true),
                    Map.entry("logging-config", "<root>=INFO"),
                    Map.entry("no-proxy", "jujucharms.com"),
                    Map.entry("update-status-hook-interval", "5m")
                ))
                .build());
    
        }
    }
    
    resources:
      this:
        type: juju:Model
        properties:
          clouds:
            - name: aws
              region: eu-west-1
          config:
            development: true
            logging-config: <root>=INFO
            no-proxy: jujucharms.com
            update-status-hook-interval: 5m
    

    Create Model Resource

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

    Constructor syntax

    new Model(name: string, args?: ModelArgs, opts?: CustomResourceOptions);
    @overload
    def Model(resource_name: str,
              args: Optional[ModelArgs] = None,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Model(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              annotations: Optional[Mapping[str, str]] = None,
              clouds: Optional[Sequence[ModelCloudArgs]] = None,
              config: Optional[Mapping[str, str]] = None,
              constraints: Optional[str] = None,
              credential: Optional[str] = None,
              name: Optional[str] = None)
    func NewModel(ctx *Context, name string, args *ModelArgs, opts ...ResourceOption) (*Model, error)
    public Model(string name, ModelArgs? args = null, CustomResourceOptions? opts = null)
    public Model(String name, ModelArgs args)
    public Model(String name, ModelArgs args, CustomResourceOptions options)
    
    type: juju:Model
    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 ModelArgs
    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 ModelArgs
    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 ModelArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ModelArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ModelArgs
    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 modelResource = new Juju.Model("modelResource", new()
    {
        Annotations = 
        {
            { "string", "string" },
        },
        Clouds = new[]
        {
            new Juju.Inputs.ModelCloudArgs
            {
                Name = "string",
                Region = "string",
            },
        },
        Config = 
        {
            { "string", "string" },
        },
        Constraints = "string",
        Credential = "string",
        Name = "string",
    });
    
    example, err := juju.NewModel(ctx, "modelResource", &juju.ModelArgs{
    	Annotations: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Clouds: juju.ModelCloudArray{
    		&juju.ModelCloudArgs{
    			Name:   pulumi.String("string"),
    			Region: pulumi.String("string"),
    		},
    	},
    	Config: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Constraints: pulumi.String("string"),
    	Credential:  pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var modelResource = new Model("modelResource", ModelArgs.builder()
        .annotations(Map.of("string", "string"))
        .clouds(ModelCloudArgs.builder()
            .name("string")
            .region("string")
            .build())
        .config(Map.of("string", "string"))
        .constraints("string")
        .credential("string")
        .name("string")
        .build());
    
    model_resource = juju.Model("modelResource",
        annotations={
            "string": "string",
        },
        clouds=[{
            "name": "string",
            "region": "string",
        }],
        config={
            "string": "string",
        },
        constraints="string",
        credential="string",
        name="string")
    
    const modelResource = new juju.Model("modelResource", {
        annotations: {
            string: "string",
        },
        clouds: [{
            name: "string",
            region: "string",
        }],
        config: {
            string: "string",
        },
        constraints: "string",
        credential: "string",
        name: "string",
    });
    
    type: juju:Model
    properties:
        annotations:
            string: string
        clouds:
            - name: string
              region: string
        config:
            string: string
        constraints: string
        credential: string
        name: string
    

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

    Annotations Dictionary<string, string>
    Annotations for the model
    Clouds List<ModelCloud>
    Config Dictionary<string, string>
    Override default model configuration
    Constraints string
    Constraints imposed to this model
    Credential string
    Credential used to add the model
    Name string
    Annotations map[string]string
    Annotations for the model
    Clouds []ModelCloudArgs
    Config map[string]string
    Override default model configuration
    Constraints string
    Constraints imposed to this model
    Credential string
    Credential used to add the model
    Name string
    annotations Map<String,String>
    Annotations for the model
    clouds List<ModelCloud>
    config Map<String,String>
    Override default model configuration
    constraints String
    Constraints imposed to this model
    credential String
    Credential used to add the model
    name String
    annotations {[key: string]: string}
    Annotations for the model
    clouds ModelCloud[]
    config {[key: string]: string}
    Override default model configuration
    constraints string
    Constraints imposed to this model
    credential string
    Credential used to add the model
    name string
    annotations Mapping[str, str]
    Annotations for the model
    clouds Sequence[ModelCloudArgs]
    config Mapping[str, str]
    Override default model configuration
    constraints str
    Constraints imposed to this model
    credential str
    Credential used to add the model
    name str
    annotations Map<String>
    Annotations for the model
    clouds List<Property Map>
    config Map<String>
    Override default model configuration
    constraints String
    Constraints imposed to this model
    credential String
    Credential used to add the model
    name String

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Type string
    Type of the model. Set by the Juju's API server
    Uuid string
    The uuid of the model
    Id string
    The provider-assigned unique ID for this managed resource.
    Type string
    Type of the model. Set by the Juju's API server
    Uuid string
    The uuid of the model
    id String
    The provider-assigned unique ID for this managed resource.
    type String
    Type of the model. Set by the Juju's API server
    uuid String
    The uuid of the model
    id string
    The provider-assigned unique ID for this managed resource.
    type string
    Type of the model. Set by the Juju's API server
    uuid string
    The uuid of the model
    id str
    The provider-assigned unique ID for this managed resource.
    type str
    Type of the model. Set by the Juju's API server
    uuid str
    The uuid of the model
    id String
    The provider-assigned unique ID for this managed resource.
    type String
    Type of the model. Set by the Juju's API server
    uuid String
    The uuid of the model

    Look up Existing Model Resource

    Get an existing Model 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?: ModelState, opts?: CustomResourceOptions): Model
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            annotations: Optional[Mapping[str, str]] = None,
            clouds: Optional[Sequence[ModelCloudArgs]] = None,
            config: Optional[Mapping[str, str]] = None,
            constraints: Optional[str] = None,
            credential: Optional[str] = None,
            name: Optional[str] = None,
            type: Optional[str] = None,
            uuid: Optional[str] = None) -> Model
    func GetModel(ctx *Context, name string, id IDInput, state *ModelState, opts ...ResourceOption) (*Model, error)
    public static Model Get(string name, Input<string> id, ModelState? state, CustomResourceOptions? opts = null)
    public static Model get(String name, Output<String> id, ModelState state, CustomResourceOptions options)
    resources:  _:    type: juju:Model    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:
    Annotations Dictionary<string, string>
    Annotations for the model
    Clouds List<ModelCloud>
    Config Dictionary<string, string>
    Override default model configuration
    Constraints string
    Constraints imposed to this model
    Credential string
    Credential used to add the model
    Name string
    Type string
    Type of the model. Set by the Juju's API server
    Uuid string
    The uuid of the model
    Annotations map[string]string
    Annotations for the model
    Clouds []ModelCloudArgs
    Config map[string]string
    Override default model configuration
    Constraints string
    Constraints imposed to this model
    Credential string
    Credential used to add the model
    Name string
    Type string
    Type of the model. Set by the Juju's API server
    Uuid string
    The uuid of the model
    annotations Map<String,String>
    Annotations for the model
    clouds List<ModelCloud>
    config Map<String,String>
    Override default model configuration
    constraints String
    Constraints imposed to this model
    credential String
    Credential used to add the model
    name String
    type String
    Type of the model. Set by the Juju's API server
    uuid String
    The uuid of the model
    annotations {[key: string]: string}
    Annotations for the model
    clouds ModelCloud[]
    config {[key: string]: string}
    Override default model configuration
    constraints string
    Constraints imposed to this model
    credential string
    Credential used to add the model
    name string
    type string
    Type of the model. Set by the Juju's API server
    uuid string
    The uuid of the model
    annotations Mapping[str, str]
    Annotations for the model
    clouds Sequence[ModelCloudArgs]
    config Mapping[str, str]
    Override default model configuration
    constraints str
    Constraints imposed to this model
    credential str
    Credential used to add the model
    name str
    type str
    Type of the model. Set by the Juju's API server
    uuid str
    The uuid of the model
    annotations Map<String>
    Annotations for the model
    clouds List<Property Map>
    config Map<String>
    Override default model configuration
    constraints String
    Constraints imposed to this model
    credential String
    Credential used to add the model
    name String
    type String
    Type of the model. Set by the Juju's API server
    uuid String
    The uuid of the model

    Supporting Types

    ModelCloud, ModelCloudArgs

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

    Import

    Limitations of Import

    Any entries of the config attribute specified in the Terraform configuration are ignored. You can add entries to the config map and manage them using Terraform after import.

    Once imported you must add the desired model configuration and run a pulumi up. This will report no changes but Terraform will be tracking the specified model configuration.

    The limitation is intentional. It exists as, without it, Terraform would import all model configuration including defaults. It may not be desirable to manage defaults using Terraform.

    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