1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. VpcDhcpIp
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.VpcDhcpIp

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a vpc dhcp_ip

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const zones = tencentcloud.getAvailabilityZones({});
    const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
    const subnet = new tencentcloud.Subnet("subnet", {
        availabilityZone: zones.then(zones => zones.zones?.[0]?.name),
        vpcId: vpc.vpcId,
        cidrBlock: "10.0.0.0/16",
        isMulticast: false,
    });
    const example = new tencentcloud.VpcDhcpIp("example", {
        vpcId: vpc.vpcId,
        subnetId: subnet.subnetId,
        dhcpIpName: "tf-example",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    zones = tencentcloud.get_availability_zones()
    vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
    subnet = tencentcloud.Subnet("subnet",
        availability_zone=zones.zones[0].name,
        vpc_id=vpc.vpc_id,
        cidr_block="10.0.0.0/16",
        is_multicast=False)
    example = tencentcloud.VpcDhcpIp("example",
        vpc_id=vpc.vpc_id,
        subnet_id=subnet.subnet_id,
        dhcp_ip_name="tf-example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		zones, err := tencentcloud.GetAvailabilityZones(ctx, &tencentcloud.GetAvailabilityZonesArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
    			CidrBlock: pulumi.String("10.0.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
    			AvailabilityZone: pulumi.String(zones.Zones[0].Name),
    			VpcId:            vpc.VpcId,
    			CidrBlock:        pulumi.String("10.0.0.0/16"),
    			IsMulticast:      pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewVpcDhcpIp(ctx, "example", &tencentcloud.VpcDhcpIpArgs{
    			VpcId:      vpc.VpcId,
    			SubnetId:   subnet.SubnetId,
    			DhcpIpName: pulumi.String("tf-example"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var zones = Tencentcloud.GetAvailabilityZones.Invoke();
    
        var vpc = new Tencentcloud.Vpc("vpc", new()
        {
            CidrBlock = "10.0.0.0/16",
        });
    
        var subnet = new Tencentcloud.Subnet("subnet", new()
        {
            AvailabilityZone = zones.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Zones[0]?.Name),
            VpcId = vpc.VpcId,
            CidrBlock = "10.0.0.0/16",
            IsMulticast = false,
        });
    
        var example = new Tencentcloud.VpcDhcpIp("example", new()
        {
            VpcId = vpc.VpcId,
            SubnetId = subnet.SubnetId,
            DhcpIpName = "tf-example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetAvailabilityZonesArgs;
    import com.pulumi.tencentcloud.Vpc;
    import com.pulumi.tencentcloud.VpcArgs;
    import com.pulumi.tencentcloud.Subnet;
    import com.pulumi.tencentcloud.SubnetArgs;
    import com.pulumi.tencentcloud.VpcDhcpIp;
    import com.pulumi.tencentcloud.VpcDhcpIpArgs;
    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 zones = TencentcloudFunctions.getAvailabilityZones();
    
            var vpc = new Vpc("vpc", VpcArgs.builder()
                .cidrBlock("10.0.0.0/16")
                .build());
    
            var subnet = new Subnet("subnet", SubnetArgs.builder()
                .availabilityZone(zones.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.zones()[0].name()))
                .vpcId(vpc.vpcId())
                .cidrBlock("10.0.0.0/16")
                .isMulticast(false)
                .build());
    
            var example = new VpcDhcpIp("example", VpcDhcpIpArgs.builder()
                .vpcId(vpc.vpcId())
                .subnetId(subnet.subnetId())
                .dhcpIpName("tf-example")
                .build());
    
        }
    }
    
    resources:
      vpc:
        type: tencentcloud:Vpc
        properties:
          cidrBlock: 10.0.0.0/16
      subnet:
        type: tencentcloud:Subnet
        properties:
          availabilityZone: ${zones.zones[0].name}
          vpcId: ${vpc.vpcId}
          cidrBlock: 10.0.0.0/16
          isMulticast: false
      example:
        type: tencentcloud:VpcDhcpIp
        properties:
          vpcId: ${vpc.vpcId}
          subnetId: ${subnet.subnetId}
          dhcpIpName: tf-example
    variables:
      zones:
        fn::invoke:
          function: tencentcloud:getAvailabilityZones
          arguments: {}
    

    Create VpcDhcpIp Resource

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

    Constructor syntax

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

    VpcDhcpIp Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The VpcDhcpIp resource accepts the following input properties:

    DhcpIpName string
    DhcpIp name.
    SubnetId string
    Subnet ID.
    VpcId string
    The private network ID.
    VpcDhcpIpId string
    ID of the resource.
    DhcpIpName string
    DhcpIp name.
    SubnetId string
    Subnet ID.
    VpcId string
    The private network ID.
    VpcDhcpIpId string
    ID of the resource.
    dhcpIpName String
    DhcpIp name.
    subnetId String
    Subnet ID.
    vpcId String
    The private network ID.
    vpcDhcpIpId String
    ID of the resource.
    dhcpIpName string
    DhcpIp name.
    subnetId string
    Subnet ID.
    vpcId string
    The private network ID.
    vpcDhcpIpId string
    ID of the resource.
    dhcp_ip_name str
    DhcpIp name.
    subnet_id str
    Subnet ID.
    vpc_id str
    The private network ID.
    vpc_dhcp_ip_id str
    ID of the resource.
    dhcpIpName String
    DhcpIp name.
    subnetId String
    Subnet ID.
    vpcId String
    The private network ID.
    vpcDhcpIpId String
    ID of the resource.

    Outputs

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

    Get an existing VpcDhcpIp 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?: VpcDhcpIpState, opts?: CustomResourceOptions): VpcDhcpIp
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            dhcp_ip_name: Optional[str] = None,
            subnet_id: Optional[str] = None,
            vpc_dhcp_ip_id: Optional[str] = None,
            vpc_id: Optional[str] = None) -> VpcDhcpIp
    func GetVpcDhcpIp(ctx *Context, name string, id IDInput, state *VpcDhcpIpState, opts ...ResourceOption) (*VpcDhcpIp, error)
    public static VpcDhcpIp Get(string name, Input<string> id, VpcDhcpIpState? state, CustomResourceOptions? opts = null)
    public static VpcDhcpIp get(String name, Output<String> id, VpcDhcpIpState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:VpcDhcpIp    get:      id: ${id}
    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:
    DhcpIpName string
    DhcpIp name.
    SubnetId string
    Subnet ID.
    VpcDhcpIpId string
    ID of the resource.
    VpcId string
    The private network ID.
    DhcpIpName string
    DhcpIp name.
    SubnetId string
    Subnet ID.
    VpcDhcpIpId string
    ID of the resource.
    VpcId string
    The private network ID.
    dhcpIpName String
    DhcpIp name.
    subnetId String
    Subnet ID.
    vpcDhcpIpId String
    ID of the resource.
    vpcId String
    The private network ID.
    dhcpIpName string
    DhcpIp name.
    subnetId string
    Subnet ID.
    vpcDhcpIpId string
    ID of the resource.
    vpcId string
    The private network ID.
    dhcp_ip_name str
    DhcpIp name.
    subnet_id str
    Subnet ID.
    vpc_dhcp_ip_id str
    ID of the resource.
    vpc_id str
    The private network ID.
    dhcpIpName String
    DhcpIp name.
    subnetId String
    Subnet ID.
    vpcDhcpIpId String
    ID of the resource.
    vpcId String
    The private network ID.

    Import

    vpc dhcp_ip can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/vpcDhcpIp:VpcDhcpIp dhcp_ip dhcp_ip_id
    

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

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack