1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. vpc
  5. DhcpOptionsSetAttachment
Alibaba Cloud v3.49.0 published on Sunday, Feb 4, 2024 by Pulumi

alicloud.vpc.DhcpOptionsSetAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.49.0 published on Sunday, Feb 4, 2024 by Pulumi

    Provides a VPC Dhcp Options Set Attachment resource.

    For information about VPC Dhcp Options Set and how to use it, see What is Dhcp Options Set.

    NOTE: Available since v1.153.0.

    Example Usage

    Basic Usage

    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 exampleNetwork = new AliCloud.Vpc.Network("exampleNetwork", new()
        {
            VpcName = name,
            CidrBlock = "10.4.0.0/16",
        });
    
        var exampleDhcpOptionsSet = new AliCloud.Vpc.DhcpOptionsSet("exampleDhcpOptionsSet", new()
        {
            DhcpOptionsSetName = name,
            DhcpOptionsSetDescription = name,
            DomainName = "example.com",
            DomainNameServers = "100.100.2.136",
        });
    
        var exampleDhcpOptionsSetAttachment = new AliCloud.Vpc.DhcpOptionsSetAttachment("exampleDhcpOptionsSetAttachment", new()
        {
            VpcId = exampleNetwork.Id,
            DhcpOptionsSetId = exampleDhcpOptionsSet.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"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
    		}
    		exampleNetwork, err := vpc.NewNetwork(ctx, "exampleNetwork", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("10.4.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleDhcpOptionsSet, err := vpc.NewDhcpOptionsSet(ctx, "exampleDhcpOptionsSet", &vpc.DhcpOptionsSetArgs{
    			DhcpOptionsSetName:        pulumi.String(name),
    			DhcpOptionsSetDescription: pulumi.String(name),
    			DomainName:                pulumi.String("example.com"),
    			DomainNameServers:         pulumi.String("100.100.2.136"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vpc.NewDhcpOptionsSetAttachment(ctx, "exampleDhcpOptionsSetAttachment", &vpc.DhcpOptionsSetAttachmentArgs{
    			VpcId:            exampleNetwork.ID(),
    			DhcpOptionsSetId: exampleDhcpOptionsSet.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.DhcpOptionsSet;
    import com.pulumi.alicloud.vpc.DhcpOptionsSetArgs;
    import com.pulumi.alicloud.vpc.DhcpOptionsSetAttachment;
    import com.pulumi.alicloud.vpc.DhcpOptionsSetAttachmentArgs;
    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");
            var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()        
                .vpcName(name)
                .cidrBlock("10.4.0.0/16")
                .build());
    
            var exampleDhcpOptionsSet = new DhcpOptionsSet("exampleDhcpOptionsSet", DhcpOptionsSetArgs.builder()        
                .dhcpOptionsSetName(name)
                .dhcpOptionsSetDescription(name)
                .domainName("example.com")
                .domainNameServers("100.100.2.136")
                .build());
    
            var exampleDhcpOptionsSetAttachment = new DhcpOptionsSetAttachment("exampleDhcpOptionsSetAttachment", DhcpOptionsSetAttachmentArgs.builder()        
                .vpcId(exampleNetwork.id())
                .dhcpOptionsSetId(exampleDhcpOptionsSet.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    example_network = alicloud.vpc.Network("exampleNetwork",
        vpc_name=name,
        cidr_block="10.4.0.0/16")
    example_dhcp_options_set = alicloud.vpc.DhcpOptionsSet("exampleDhcpOptionsSet",
        dhcp_options_set_name=name,
        dhcp_options_set_description=name,
        domain_name="example.com",
        domain_name_servers="100.100.2.136")
    example_dhcp_options_set_attachment = alicloud.vpc.DhcpOptionsSetAttachment("exampleDhcpOptionsSetAttachment",
        vpc_id=example_network.id,
        dhcp_options_set_id=example_dhcp_options_set.id)
    
    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 exampleNetwork = new alicloud.vpc.Network("exampleNetwork", {
        vpcName: name,
        cidrBlock: "10.4.0.0/16",
    });
    const exampleDhcpOptionsSet = new alicloud.vpc.DhcpOptionsSet("exampleDhcpOptionsSet", {
        dhcpOptionsSetName: name,
        dhcpOptionsSetDescription: name,
        domainName: "example.com",
        domainNameServers: "100.100.2.136",
    });
    const exampleDhcpOptionsSetAttachment = new alicloud.vpc.DhcpOptionsSetAttachment("exampleDhcpOptionsSetAttachment", {
        vpcId: exampleNetwork.id,
        dhcpOptionsSetId: exampleDhcpOptionsSet.id,
    });
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      exampleNetwork:
        type: alicloud:vpc:Network
        properties:
          vpcName: ${name}
          cidrBlock: 10.4.0.0/16
      exampleDhcpOptionsSet:
        type: alicloud:vpc:DhcpOptionsSet
        properties:
          dhcpOptionsSetName: ${name}
          dhcpOptionsSetDescription: ${name}
          domainName: example.com
          domainNameServers: 100.100.2.136
      exampleDhcpOptionsSetAttachment:
        type: alicloud:vpc:DhcpOptionsSetAttachment
        properties:
          vpcId: ${exampleNetwork.id}
          dhcpOptionsSetId: ${exampleDhcpOptionsSet.id}
    

    Create DhcpOptionsSetAttachment Resource

    new DhcpOptionsSetAttachment(name: string, args: DhcpOptionsSetAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def DhcpOptionsSetAttachment(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 dhcp_options_set_id: Optional[str] = None,
                                 dry_run: Optional[bool] = None,
                                 vpc_id: Optional[str] = None)
    @overload
    def DhcpOptionsSetAttachment(resource_name: str,
                                 args: DhcpOptionsSetAttachmentArgs,
                                 opts: Optional[ResourceOptions] = None)
    func NewDhcpOptionsSetAttachment(ctx *Context, name string, args DhcpOptionsSetAttachmentArgs, opts ...ResourceOption) (*DhcpOptionsSetAttachment, error)
    public DhcpOptionsSetAttachment(string name, DhcpOptionsSetAttachmentArgs args, CustomResourceOptions? opts = null)
    public DhcpOptionsSetAttachment(String name, DhcpOptionsSetAttachmentArgs args)
    public DhcpOptionsSetAttachment(String name, DhcpOptionsSetAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:vpc:DhcpOptionsSetAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args DhcpOptionsSetAttachmentArgs
    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 DhcpOptionsSetAttachmentArgs
    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 DhcpOptionsSetAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DhcpOptionsSetAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DhcpOptionsSetAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    DhcpOptionsSetId string
    The ID of the DHCP options set.
    VpcId string
    The ID of the VPC network that is to be associated with the DHCP options set..
    DryRun bool
    Specifies whether to precheck this request only. Default values: false. Valid values:
    DhcpOptionsSetId string
    The ID of the DHCP options set.
    VpcId string
    The ID of the VPC network that is to be associated with the DHCP options set..
    DryRun bool
    Specifies whether to precheck this request only. Default values: false. Valid values:
    dhcpOptionsSetId String
    The ID of the DHCP options set.
    vpcId String
    The ID of the VPC network that is to be associated with the DHCP options set..
    dryRun Boolean
    Specifies whether to precheck this request only. Default values: false. Valid values:
    dhcpOptionsSetId string
    The ID of the DHCP options set.
    vpcId string
    The ID of the VPC network that is to be associated with the DHCP options set..
    dryRun boolean
    Specifies whether to precheck this request only. Default values: false. Valid values:
    dhcp_options_set_id str
    The ID of the DHCP options set.
    vpc_id str
    The ID of the VPC network that is to be associated with the DHCP options set..
    dry_run bool
    Specifies whether to precheck this request only. Default values: false. Valid values:
    dhcpOptionsSetId String
    The ID of the DHCP options set.
    vpcId String
    The ID of the VPC network that is to be associated with the DHCP options set..
    dryRun Boolean
    Specifies whether to precheck this request only. Default values: false. Valid values:

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.

    Look up Existing DhcpOptionsSetAttachment Resource

    Get an existing DhcpOptionsSetAttachment 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?: DhcpOptionsSetAttachmentState, opts?: CustomResourceOptions): DhcpOptionsSetAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            dhcp_options_set_id: Optional[str] = None,
            dry_run: Optional[bool] = None,
            status: Optional[str] = None,
            vpc_id: Optional[str] = None) -> DhcpOptionsSetAttachment
    func GetDhcpOptionsSetAttachment(ctx *Context, name string, id IDInput, state *DhcpOptionsSetAttachmentState, opts ...ResourceOption) (*DhcpOptionsSetAttachment, error)
    public static DhcpOptionsSetAttachment Get(string name, Input<string> id, DhcpOptionsSetAttachmentState? state, CustomResourceOptions? opts = null)
    public static DhcpOptionsSetAttachment get(String name, Output<String> id, DhcpOptionsSetAttachmentState 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:
    DhcpOptionsSetId string
    The ID of the DHCP options set.
    DryRun bool
    Specifies whether to precheck this request only. Default values: false. Valid values:
    Status string
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    VpcId string
    The ID of the VPC network that is to be associated with the DHCP options set..
    DhcpOptionsSetId string
    The ID of the DHCP options set.
    DryRun bool
    Specifies whether to precheck this request only. Default values: false. Valid values:
    Status string
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    VpcId string
    The ID of the VPC network that is to be associated with the DHCP options set..
    dhcpOptionsSetId String
    The ID of the DHCP options set.
    dryRun Boolean
    Specifies whether to precheck this request only. Default values: false. Valid values:
    status String
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    vpcId String
    The ID of the VPC network that is to be associated with the DHCP options set..
    dhcpOptionsSetId string
    The ID of the DHCP options set.
    dryRun boolean
    Specifies whether to precheck this request only. Default values: false. Valid values:
    status string
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    vpcId string
    The ID of the VPC network that is to be associated with the DHCP options set..
    dhcp_options_set_id str
    The ID of the DHCP options set.
    dry_run bool
    Specifies whether to precheck this request only. Default values: false. Valid values:
    status str
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    vpc_id str
    The ID of the VPC network that is to be associated with the DHCP options set..
    dhcpOptionsSetId String
    The ID of the DHCP options set.
    dryRun Boolean
    Specifies whether to precheck this request only. Default values: false. Valid values:
    status String
    The status of the VPC network that is associated with the DHCP options set. Valid values: InUse or Pending.
    vpcId String
    The ID of the VPC network that is to be associated with the DHCP options set..

    Import

    VPC Dhcp Options Set Attachment can be imported using the id, e.g.

     $ pulumi import alicloud:vpc/dhcpOptionsSetAttachment:DhcpOptionsSetAttachment example <id>
    

    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.49.0 published on Sunday, Feb 4, 2024 by Pulumi