1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. eflo
  5. Subnet
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.eflo.Subnet

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Provides a Eflo Subnet resource.

    For information about Eflo Subnet and how to use it, see What is Subnet.

    NOTE: Available since v1.204.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const defaultZones = alicloud.getZones({});
    const defaultResourceGroups = alicloud.resourcemanager.getResourceGroups({});
    const defaultVpd = new alicloud.eflo.Vpd("defaultVpd", {
        cidr: "10.0.0.0/8",
        vpdName: name,
        resourceGroupId: defaultResourceGroups.then(defaultResourceGroups => defaultResourceGroups.groups?.[0]?.id),
    });
    const defaultSubnet = new alicloud.eflo.Subnet("defaultSubnet", {
        subnetName: name,
        zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[0]?.id),
        cidr: "10.0.0.0/16",
        vpdId: defaultVpd.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default_zones = alicloud.get_zones()
    default_resource_groups = alicloud.resourcemanager.get_resource_groups()
    default_vpd = alicloud.eflo.Vpd("defaultVpd",
        cidr="10.0.0.0/8",
        vpd_name=name,
        resource_group_id=default_resource_groups.groups[0].id)
    default_subnet = alicloud.eflo.Subnet("defaultSubnet",
        subnet_name=name,
        zone_id=default_zones.zones[0].id,
        cidr="10.0.0.0/16",
        vpd_id=default_vpd.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/eflo"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultZones, err := alicloud.GetZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultResourceGroups, err := resourcemanager.GetResourceGroups(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultVpd, err := eflo.NewVpd(ctx, "defaultVpd", &eflo.VpdArgs{
    			Cidr:            pulumi.String("10.0.0.0/8"),
    			VpdName:         pulumi.String(name),
    			ResourceGroupId: pulumi.String(defaultResourceGroups.Groups[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = eflo.NewSubnet(ctx, "defaultSubnet", &eflo.SubnetArgs{
    			SubnetName: pulumi.String(name),
    			ZoneId:     pulumi.String(defaultZones.Zones[0].Id),
    			Cidr:       pulumi.String("10.0.0.0/16"),
    			VpdId:      defaultVpd.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var defaultZones = AliCloud.GetZones.Invoke();
    
        var defaultResourceGroups = AliCloud.ResourceManager.GetResourceGroups.Invoke();
    
        var defaultVpd = new AliCloud.Eflo.Vpd("defaultVpd", new()
        {
            Cidr = "10.0.0.0/8",
            VpdName = name,
            ResourceGroupId = defaultResourceGroups.Apply(getResourceGroupsResult => getResourceGroupsResult.Groups[0]?.Id),
        });
    
        var defaultSubnet = new AliCloud.Eflo.Subnet("defaultSubnet", new()
        {
            SubnetName = name,
            ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            Cidr = "10.0.0.0/16",
            VpdId = defaultVpd.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetZonesArgs;
    import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
    import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
    import com.pulumi.alicloud.eflo.Vpd;
    import com.pulumi.alicloud.eflo.VpdArgs;
    import com.pulumi.alicloud.eflo.Subnet;
    import com.pulumi.alicloud.eflo.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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            final var defaultZones = AlicloudFunctions.getZones();
    
            final var defaultResourceGroups = ResourcemanagerFunctions.getResourceGroups();
    
            var defaultVpd = new Vpd("defaultVpd", VpdArgs.builder()        
                .cidr("10.0.0.0/8")
                .vpdName(name)
                .resourceGroupId(defaultResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.groups()[0].id()))
                .build());
    
            var defaultSubnet = new Subnet("defaultSubnet", SubnetArgs.builder()        
                .subnetName(name)
                .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .cidr("10.0.0.0/16")
                .vpdId(defaultVpd.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultVpd:
        type: alicloud:eflo:Vpd
        properties:
          cidr: 10.0.0.0/8
          vpdName: ${name}
          resourceGroupId: ${defaultResourceGroups.groups[0].id}
      defaultSubnet:
        type: alicloud:eflo:Subnet
        properties:
          subnetName: ${name}
          zoneId: ${defaultZones.zones[0].id}
          cidr: 10.0.0.0/16
          vpdId: ${defaultVpd.id}
    variables:
      defaultZones:
        fn::invoke:
          Function: alicloud:getZones
          Arguments: {}
      defaultResourceGroups:
        fn::invoke:
          Function: alicloud:resourcemanager:getResourceGroups
          Arguments: {}
    

    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,
               subnet_name: Optional[str] = None,
               vpd_id: Optional[str] = None,
               zone_id: Optional[str] = None,
               type: 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: alicloud:eflo:Subnet
    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 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.

    Example

    The following reference example uses placeholder values for all input properties.

    var subnetResource = new AliCloud.Eflo.Subnet("subnetResource", new()
    {
        Cidr = "string",
        SubnetName = "string",
        VpdId = "string",
        ZoneId = "string",
        Type = "string",
    });
    
    example, err := eflo.NewSubnet(ctx, "subnetResource", &eflo.SubnetArgs{
    	Cidr:       pulumi.String("string"),
    	SubnetName: pulumi.String("string"),
    	VpdId:      pulumi.String("string"),
    	ZoneId:     pulumi.String("string"),
    	Type:       pulumi.String("string"),
    })
    
    var subnetResource = new Subnet("subnetResource", SubnetArgs.builder()        
        .cidr("string")
        .subnetName("string")
        .vpdId("string")
        .zoneId("string")
        .type("string")
        .build());
    
    subnet_resource = alicloud.eflo.Subnet("subnetResource",
        cidr="string",
        subnet_name="string",
        vpd_id="string",
        zone_id="string",
        type="string")
    
    const subnetResource = new alicloud.eflo.Subnet("subnetResource", {
        cidr: "string",
        subnetName: "string",
        vpdId: "string",
        zoneId: "string",
        type: "string",
    });
    
    type: alicloud:eflo:Subnet
    properties:
        cidr: string
        subnetName: string
        type: string
        vpdId: string
        zoneId: 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

    The Subnet resource accepts the following input properties:

    Cidr string
    CIDR network segment.
    SubnetName string
    The Subnet name.
    VpdId string
    The Eflo VPD ID.
    ZoneId string
    The zone ID of the resource.
    Type string
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    Cidr string
    CIDR network segment.
    SubnetName string
    The Subnet name.
    VpdId string
    The Eflo VPD ID.
    ZoneId string
    The zone ID of the resource.
    Type string
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    cidr String
    CIDR network segment.
    subnetName String
    The Subnet name.
    vpdId String
    The Eflo VPD ID.
    zoneId String
    The zone ID of the resource.
    type String
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    cidr string
    CIDR network segment.
    subnetName string
    The Subnet name.
    vpdId string
    The Eflo VPD ID.
    zoneId string
    The zone ID of the resource.
    type string
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    cidr str
    CIDR network segment.
    subnet_name str
    The Subnet name.
    vpd_id str
    The Eflo VPD ID.
    zone_id str
    The zone ID of the resource.
    type str
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    cidr String
    CIDR network segment.
    subnetName String
    The Subnet name.
    vpdId String
    The Eflo VPD ID.
    zoneId String
    The zone ID of the resource.
    type String
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type

    Outputs

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

    CreateTime string
    The creation time of the resource.
    GmtModified string
    Modification time.
    Id string
    The provider-assigned unique ID for this managed resource.
    Message string
    Error message.
    ResourceGroupId string
    Resource Group ID.
    Status string
    The status of the resource.
    SubnetId string
    The id of the subnet.
    CreateTime string
    The creation time of the resource.
    GmtModified string
    Modification time.
    Id string
    The provider-assigned unique ID for this managed resource.
    Message string
    Error message.
    ResourceGroupId string
    Resource Group ID.
    Status string
    The status of the resource.
    SubnetId string
    The id of the subnet.
    createTime String
    The creation time of the resource.
    gmtModified String
    Modification time.
    id String
    The provider-assigned unique ID for this managed resource.
    message String
    Error message.
    resourceGroupId String
    Resource Group ID.
    status String
    The status of the resource.
    subnetId String
    The id of the subnet.
    createTime string
    The creation time of the resource.
    gmtModified string
    Modification time.
    id string
    The provider-assigned unique ID for this managed resource.
    message string
    Error message.
    resourceGroupId string
    Resource Group ID.
    status string
    The status of the resource.
    subnetId string
    The id of the subnet.
    create_time str
    The creation time of the resource.
    gmt_modified str
    Modification time.
    id str
    The provider-assigned unique ID for this managed resource.
    message str
    Error message.
    resource_group_id str
    Resource Group ID.
    status str
    The status of the resource.
    subnet_id str
    The id of the subnet.
    createTime String
    The creation time of the resource.
    gmtModified String
    Modification time.
    id String
    The provider-assigned unique ID for this managed resource.
    message String
    Error message.
    resourceGroupId String
    Resource Group ID.
    status String
    The status of the resource.
    subnetId String
    The id of the subnet.

    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,
            create_time: Optional[str] = None,
            gmt_modified: Optional[str] = None,
            message: Optional[str] = None,
            resource_group_id: Optional[str] = None,
            status: Optional[str] = None,
            subnet_id: Optional[str] = None,
            subnet_name: Optional[str] = None,
            type: Optional[str] = None,
            vpd_id: Optional[str] = None,
            zone_id: Optional[str] = None) -> Subnet
    func 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)
    Resource lookup is not supported in YAML
    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:
    Cidr string
    CIDR network segment.
    CreateTime string
    The creation time of the resource.
    GmtModified string
    Modification time.
    Message string
    Error message.
    ResourceGroupId string
    Resource Group ID.
    Status string
    The status of the resource.
    SubnetId string
    The id of the subnet.
    SubnetName string
    The Subnet name.
    Type string
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    VpdId string
    The Eflo VPD ID.
    ZoneId string
    The zone ID of the resource.
    Cidr string
    CIDR network segment.
    CreateTime string
    The creation time of the resource.
    GmtModified string
    Modification time.
    Message string
    Error message.
    ResourceGroupId string
    Resource Group ID.
    Status string
    The status of the resource.
    SubnetId string
    The id of the subnet.
    SubnetName string
    The Subnet name.
    Type string
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    VpdId string
    The Eflo VPD ID.
    ZoneId string
    The zone ID of the resource.
    cidr String
    CIDR network segment.
    createTime String
    The creation time of the resource.
    gmtModified String
    Modification time.
    message String
    Error message.
    resourceGroupId String
    Resource Group ID.
    status String
    The status of the resource.
    subnetId String
    The id of the subnet.
    subnetName String
    The Subnet name.
    type String
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    vpdId String
    The Eflo VPD ID.
    zoneId String
    The zone ID of the resource.
    cidr string
    CIDR network segment.
    createTime string
    The creation time of the resource.
    gmtModified string
    Modification time.
    message string
    Error message.
    resourceGroupId string
    Resource Group ID.
    status string
    The status of the resource.
    subnetId string
    The id of the subnet.
    subnetName string
    The Subnet name.
    type string
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    vpdId string
    The Eflo VPD ID.
    zoneId string
    The zone ID of the resource.
    cidr str
    CIDR network segment.
    create_time str
    The creation time of the resource.
    gmt_modified str
    Modification time.
    message str
    Error message.
    resource_group_id str
    Resource Group ID.
    status str
    The status of the resource.
    subnet_id str
    The id of the subnet.
    subnet_name str
    The Subnet name.
    type str
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    vpd_id str
    The Eflo VPD ID.
    zone_id str
    The zone ID of the resource.
    cidr String
    CIDR network segment.
    createTime String
    The creation time of the resource.
    gmtModified String
    Modification time.
    message String
    Error message.
    resourceGroupId String
    Resource Group ID.
    status String
    The status of the resource.
    subnetId String
    The id of the subnet.
    subnetName String
    The Subnet name.
    type String
    Eflo subnet usage type. optional value:

    • General type is not filled in
    • OOB:OOB type
    • LB: LB type
    vpdId String
    The Eflo VPD ID.
    zoneId String
    The zone ID of the resource.

    Import

    Eflo Subnet can be imported using the id, e.g.

    $ pulumi import alicloud:eflo/subnet:Subnet example <vpd_id>:<subnet_id>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi