1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. VpcDhcpOptionsAssociation

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.3.0 published on Thursday, Sep 28, 2023 by Pulumi

aws.ec2.VpcDhcpOptionsAssociation

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.3.0 published on Thursday, Sep 28, 2023 by Pulumi

    Provides a VPC DHCP Options Association resource.

    Remarks

    • You can only associate one DHCP Options Set to a given VPC ID.
    • Removing the DHCP Options Association automatically sets AWS’s default DHCP Options Set to the VPC.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var dnsResolver = new Aws.Ec2.VpcDhcpOptionsAssociation("dnsResolver", new()
        {
            VpcId = aws_vpc.Foo.Id,
            DhcpOptionsId = aws_vpc_dhcp_options.Foo.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewVpcDhcpOptionsAssociation(ctx, "dnsResolver", &ec2.VpcDhcpOptionsAssociationArgs{
    			VpcId:         pulumi.Any(aws_vpc.Foo.Id),
    			DhcpOptionsId: pulumi.Any(aws_vpc_dhcp_options.Foo.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.aws.ec2.VpcDhcpOptionsAssociation;
    import com.pulumi.aws.ec2.VpcDhcpOptionsAssociationArgs;
    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 dnsResolver = new VpcDhcpOptionsAssociation("dnsResolver", VpcDhcpOptionsAssociationArgs.builder()        
                .vpcId(aws_vpc.foo().id())
                .dhcpOptionsId(aws_vpc_dhcp_options.foo().id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    dns_resolver = aws.ec2.VpcDhcpOptionsAssociation("dnsResolver",
        vpc_id=aws_vpc["foo"]["id"],
        dhcp_options_id=aws_vpc_dhcp_options["foo"]["id"])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const dnsResolver = new aws.ec2.VpcDhcpOptionsAssociation("dnsResolver", {
        vpcId: aws_vpc.foo.id,
        dhcpOptionsId: aws_vpc_dhcp_options.foo.id,
    });
    
    resources:
      dnsResolver:
        type: aws:ec2:VpcDhcpOptionsAssociation
        properties:
          vpcId: ${aws_vpc.foo.id}
          dhcpOptionsId: ${aws_vpc_dhcp_options.foo.id}
    

    Create VpcDhcpOptionsAssociation Resource

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

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

    DhcpOptionsId string

    The ID of the DHCP Options Set to associate to the VPC.

    VpcId string

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    DhcpOptionsId string

    The ID of the DHCP Options Set to associate to the VPC.

    VpcId string

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcpOptionsId String

    The ID of the DHCP Options Set to associate to the VPC.

    vpcId String

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcpOptionsId string

    The ID of the DHCP Options Set to associate to the VPC.

    vpcId string

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcp_options_id str

    The ID of the DHCP Options Set to associate to the VPC.

    vpc_id str

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcpOptionsId String

    The ID of the DHCP Options Set to associate to the VPC.

    vpcId String

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VpcDhcpOptionsAssociation 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 str

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing VpcDhcpOptionsAssociation Resource

    Get an existing VpcDhcpOptionsAssociation 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?: VpcDhcpOptionsAssociationState, opts?: CustomResourceOptions): VpcDhcpOptionsAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            dhcp_options_id: Optional[str] = None,
            vpc_id: Optional[str] = None) -> VpcDhcpOptionsAssociation
    func GetVpcDhcpOptionsAssociation(ctx *Context, name string, id IDInput, state *VpcDhcpOptionsAssociationState, opts ...ResourceOption) (*VpcDhcpOptionsAssociation, error)
    public static VpcDhcpOptionsAssociation Get(string name, Input<string> id, VpcDhcpOptionsAssociationState? state, CustomResourceOptions? opts = null)
    public static VpcDhcpOptionsAssociation get(String name, Output<String> id, VpcDhcpOptionsAssociationState 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:
    DhcpOptionsId string

    The ID of the DHCP Options Set to associate to the VPC.

    VpcId string

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    DhcpOptionsId string

    The ID of the DHCP Options Set to associate to the VPC.

    VpcId string

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcpOptionsId String

    The ID of the DHCP Options Set to associate to the VPC.

    vpcId String

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcpOptionsId string

    The ID of the DHCP Options Set to associate to the VPC.

    vpcId string

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcp_options_id str

    The ID of the DHCP Options Set to associate to the VPC.

    vpc_id str

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    dhcpOptionsId String

    The ID of the DHCP Options Set to associate to the VPC.

    vpcId String

    The ID of the VPC to which we would like to associate a DHCP Options Set.

    Import

    Using pulumi import, import DHCP associations using the VPC ID associated with the options. For example:

     $ pulumi import aws:ec2/vpcDhcpOptionsAssociation:VpcDhcpOptionsAssociation imported vpc-0f001273ec18911b1
    

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the aws Terraform Provider.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.3.0 published on Thursday, Sep 28, 2023 by Pulumi