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.42.0 published on Wednesday, Jun 26, 2024 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.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a VPC DHCP Options Association resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const dnsResolver = new aws.ec2.VpcDhcpOptionsAssociation("dns_resolver", {
        vpcId: fooAwsVpc.id,
        dhcpOptionsId: foo.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    dns_resolver = aws.ec2.VpcDhcpOptionsAssociation("dns_resolver",
        vpc_id=foo_aws_vpc["id"],
        dhcp_options_id=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, "dns_resolver", &ec2.VpcDhcpOptionsAssociationArgs{
    			VpcId:         pulumi.Any(fooAwsVpc.Id),
    			DhcpOptionsId: pulumi.Any(foo.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var dnsResolver = new Aws.Ec2.VpcDhcpOptionsAssociation("dns_resolver", new()
        {
            VpcId = fooAwsVpc.Id,
            DhcpOptionsId = foo.Id,
        });
    
    });
    
    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(fooAwsVpc.id())
                .dhcpOptionsId(foo.id())
                .build());
    
        }
    }
    
    resources:
      dnsResolver:
        type: aws:ec2:VpcDhcpOptionsAssociation
        name: dns_resolver
        properties:
          vpcId: ${fooAwsVpc.id}
          dhcpOptionsId: ${foo.id}
    

    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.

    Create VpcDhcpOptionsAssociation Resource

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

    Constructor syntax

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

    Parameters

    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.

    Constructor example

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

    var vpcDhcpOptionsAssociationResource = new Aws.Ec2.VpcDhcpOptionsAssociation("vpcDhcpOptionsAssociationResource", new()
    {
        DhcpOptionsId = "string",
        VpcId = "string",
    });
    
    example, err := ec2.NewVpcDhcpOptionsAssociation(ctx, "vpcDhcpOptionsAssociationResource", &ec2.VpcDhcpOptionsAssociationArgs{
    	DhcpOptionsId: pulumi.String("string"),
    	VpcId:         pulumi.String("string"),
    })
    
    var vpcDhcpOptionsAssociationResource = new VpcDhcpOptionsAssociation("vpcDhcpOptionsAssociationResource", VpcDhcpOptionsAssociationArgs.builder()
        .dhcpOptionsId("string")
        .vpcId("string")
        .build());
    
    vpc_dhcp_options_association_resource = aws.ec2.VpcDhcpOptionsAssociation("vpcDhcpOptionsAssociationResource",
        dhcp_options_id="string",
        vpc_id="string")
    
    const vpcDhcpOptionsAssociationResource = new aws.ec2.VpcDhcpOptionsAssociation("vpcDhcpOptionsAssociationResource", {
        dhcpOptionsId: "string",
        vpcId: "string",
    });
    
    type: aws:ec2:VpcDhcpOptionsAssociation
    properties:
        dhcpOptionsId: string
        vpcId: string
    

    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
    

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

    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.42.0 published on Wednesday, Jun 26, 2024 by Pulumi