published on Tuesday, Jul 21, 2026 by juju
published on Tuesday, Jul 21, 2026 by juju
A resource that represents assignment of a subnet to a Juju space.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as juju from "@pulumi/juju";
const development = new juju.Model("development", {name: "development"});
const developmentSpace = new juju.Space("development", {
modelUuid: development.uuid,
name: "development",
});
const developmentSubnet = new juju.Subnet("development", {
modelUuid: development.uuid,
cidr: "10.0.0.0/24",
spaceName: developmentSpace.name,
});
import pulumi
import pulumi_juju as juju
development = juju.Model("development", name="development")
development_space = juju.Space("development",
model_uuid=development.uuid,
name="development")
development_subnet = juju.Subnet("development",
model_uuid=development.uuid,
cidr="10.0.0.0/24",
space_name=development_space.name)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/juju/v2/juju"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
development, err := juju.NewModel(ctx, "development", &juju.ModelArgs{
Name: pulumi.String("development"),
})
if err != nil {
return err
}
developmentSpace, err := juju.NewSpace(ctx, "development", &juju.SpaceArgs{
ModelUuid: development.Uuid,
Name: pulumi.String("development"),
})
if err != nil {
return err
}
_, err = juju.NewSubnet(ctx, "development", &juju.SubnetArgs{
ModelUuid: development.Uuid,
Cidr: pulumi.String("10.0.0.0/24"),
SpaceName: developmentSpace.Name,
})
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 development = new Juju.Model("development", new()
{
Name = "development",
});
var developmentSpace = new Juju.Space("development", new()
{
ModelUuid = development.Uuid,
Name = "development",
});
var developmentSubnet = new Juju.Subnet("development", new()
{
ModelUuid = development.Uuid,
Cidr = "10.0.0.0/24",
SpaceName = developmentSpace.Name,
});
});
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.Space;
import com.pulumi.juju.SpaceArgs;
import com.pulumi.juju.Subnet;
import com.pulumi.juju.SubnetArgs;
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 development = new Model("development", ModelArgs.builder()
.name("development")
.build());
var developmentSpace = new Space("developmentSpace", SpaceArgs.builder()
.modelUuid(development.uuid())
.name("development")
.build());
var developmentSubnet = new Subnet("developmentSubnet", SubnetArgs.builder()
.modelUuid(development.uuid())
.cidr("10.0.0.0/24")
.spaceName(developmentSpace.name())
.build());
}
}
resources:
development:
type: juju:Model
properties:
name: development
developmentSpace:
type: juju:Space
name: development
properties:
modelUuid: ${development.uuid}
name: development
developmentSubnet:
type: juju:Subnet
name: development
properties:
modelUuid: ${development.uuid}
cidr: 10.0.0.0/24
spaceName: ${developmentSpace.name}
Example coming soon!
Create Subnet Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);@overload
def Subnet(resource_name: str,
args: SubnetArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Subnet(resource_name: str,
opts: Optional[ResourceOptions] = None,
cidr: Optional[str] = None,
model_uuid: Optional[str] = None,
space_name: Optional[str] = None)func NewSubnet(ctx *Context, name string, args SubnetArgs, opts ...ResourceOption) (*Subnet, error)public Subnet(string name, SubnetArgs args, CustomResourceOptions? opts = null)
public Subnet(String name, SubnetArgs args)
public Subnet(String name, SubnetArgs args, CustomResourceOptions options)
type: juju:Subnet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "juju_subnet" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args SubnetArgs
- 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 SubnetArgs
- 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 SubnetArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SubnetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SubnetArgs
- 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 subnetResource = new Juju.Subnet("subnetResource", new()
{
Cidr = "string",
ModelUuid = "string",
SpaceName = "string",
});
example, err := juju.NewSubnet(ctx, "subnetResource", &juju.SubnetArgs{
Cidr: pulumi.String("string"),
ModelUuid: pulumi.String("string"),
SpaceName: pulumi.String("string"),
})
resource "juju_subnet" "subnetResource" {
lifecycle {
create_before_destroy = true
}
cidr = "string"
model_uuid = "string"
space_name = "string"
}
var subnetResource = new Subnet("subnetResource", SubnetArgs.builder()
.cidr("string")
.modelUuid("string")
.spaceName("string")
.build());
subnet_resource = juju.Subnet("subnetResource",
cidr="string",
model_uuid="string",
space_name="string")
const subnetResource = new juju.Subnet("subnetResource", {
cidr: "string",
modelUuid: "string",
spaceName: "string",
});
type: juju:Subnet
properties:
cidr: string
modelUuid: string
spaceName: string
Subnet 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 Subnet resource accepts the following input properties:
- cidr string
- The subnet CIDR. Changing this value forces replacement.
- model_
uuid string - The UUID of the model where the subnet exists.
- space_
name string - The target space for this subnet.
- cidr str
- The subnet CIDR. Changing this value forces replacement.
- model_
uuid str - The UUID of the model where the subnet exists.
- space_
name str - The target space for this subnet.
Outputs
All input properties are implicitly available as output properties. Additionally, the Subnet 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 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 Subnet Resource
Get an existing Subnet 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?: SubnetState, opts?: CustomResourceOptions): Subnet@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cidr: Optional[str] = None,
model_uuid: Optional[str] = None,
space_name: Optional[str] = None) -> Subnetfunc GetSubnet(ctx *Context, name string, id IDInput, state *SubnetState, opts ...ResourceOption) (*Subnet, error)public static Subnet Get(string name, Input<string> id, SubnetState? state, CustomResourceOptions? opts = null)public static Subnet get(String name, Output<String> id, SubnetState state, CustomResourceOptions options)resources: _: type: juju:Subnet get: id: ${id}import {
to = juju_subnet.example
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.
- cidr string
- The subnet CIDR. Changing this value forces replacement.
- model_
uuid string - The UUID of the model where the subnet exists.
- space_
name string - The target space for this subnet.
- cidr str
- The subnet CIDR. Changing this value forces replacement.
- model_
uuid str - The UUID of the model where the subnet exists.
- space_
name str - The target space for this subnet.
Import
The pulumi import command can be used, for example:
Subnets can be imported using the format: model_uuid:cidr
$ pulumi import juju:index/subnet:Subnet development a3c2c72a-75f6-43b9-9b2d-d85d5449cb2f:10.0.0.0/24
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
jujuTerraform Provider.
published on Tuesday, Jul 21, 2026 by juju