1. Packages
  2. Alicloud Provider
  3. API Docs
  4. vpc
  5. DhcpOptionsSetAttachment
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.vpc.DhcpOptionsSetAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 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

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

    Create DhcpOptionsSetAttachment Resource

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

    Constructor syntax

    new DhcpOptionsSetAttachment(name: string, args: DhcpOptionsSetAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def DhcpOptionsSetAttachment(resource_name: str,
                                 args: DhcpOptionsSetAttachmentArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def DhcpOptionsSetAttachment(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 dhcp_options_set_id: Optional[str] = None,
                                 vpc_id: Optional[str] = None,
                                 dry_run: Optional[bool] = 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.
    
    

    Parameters

    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.

    Constructor example

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

    var dhcpOptionsSetAttachmentResource = new AliCloud.Vpc.DhcpOptionsSetAttachment("dhcpOptionsSetAttachmentResource", new()
    {
        DhcpOptionsSetId = "string",
        VpcId = "string",
        DryRun = false,
    });
    
    example, err := vpc.NewDhcpOptionsSetAttachment(ctx, "dhcpOptionsSetAttachmentResource", &vpc.DhcpOptionsSetAttachmentArgs{
    	DhcpOptionsSetId: pulumi.String("string"),
    	VpcId:            pulumi.String("string"),
    	DryRun:           pulumi.Bool(false),
    })
    
    var dhcpOptionsSetAttachmentResource = new DhcpOptionsSetAttachment("dhcpOptionsSetAttachmentResource", DhcpOptionsSetAttachmentArgs.builder()
        .dhcpOptionsSetId("string")
        .vpcId("string")
        .dryRun(false)
        .build());
    
    dhcp_options_set_attachment_resource = alicloud.vpc.DhcpOptionsSetAttachment("dhcpOptionsSetAttachmentResource",
        dhcp_options_set_id="string",
        vpc_id="string",
        dry_run=False)
    
    const dhcpOptionsSetAttachmentResource = new alicloud.vpc.DhcpOptionsSetAttachment("dhcpOptionsSetAttachmentResource", {
        dhcpOptionsSetId: "string",
        vpcId: "string",
        dryRun: false,
    });
    
    type: alicloud:vpc:DhcpOptionsSetAttachment
    properties:
        dhcpOptionsSetId: string
        dryRun: false
        vpcId: string
    

    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>
    

    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.62.1 published on Monday, Sep 16, 2024 by Pulumi