1. Packages
  2. Volcengine
  3. API Docs
  4. eip
  5. Associate
Volcengine v0.0.25 published on Tuesday, Jul 2, 2024 by Volcengine

volcengine.eip.Associate

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.25 published on Tuesday, Jul 2, 2024 by Volcengine

    Provides a resource to manage eip associate

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooZones = Volcengine.Ecs.Zones.Invoke();
    
        var fooImages = Volcengine.Ecs.Images.Invoke(new()
        {
            OsType = "Linux",
            Visibility = "public",
            InstanceTypeId = "ecs.g1.large",
        });
    
        var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
        {
            VpcName = "acc-test-vpc",
            CidrBlock = "172.16.0.0/16",
        });
    
        var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
        {
            SubnetName = "acc-test-subnet",
            CidrBlock = "172.16.0.0/24",
            ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            VpcId = fooVpc.Id,
        });
    
        var fooSecurityGroup = new Volcengine.Vpc.SecurityGroup("fooSecurityGroup", new()
        {
            VpcId = fooVpc.Id,
            SecurityGroupName = "acc-test-security-group",
        });
    
        var fooInstance = new Volcengine.Ecs.Instance("fooInstance", new()
        {
            ImageId = fooImages.Apply(imagesResult => imagesResult.Images[0]?.ImageId),
            InstanceType = "ecs.g1.large",
            InstanceName = "acc-test-ecs-name",
            Password = "93f0cb0614Aab12",
            InstanceChargeType = "PostPaid",
            SystemVolumeType = "ESSD_PL0",
            SystemVolumeSize = 40,
            SubnetId = fooSubnet.Id,
            SecurityGroupIds = new[]
            {
                fooSecurityGroup.Id,
            },
        });
    
        var fooAddress = new Volcengine.Eip.Address("fooAddress", new()
        {
            BillingType = "PostPaidByTraffic",
        });
    
        var fooAssociate = new Volcengine.Eip.Associate("fooAssociate", new()
        {
            AllocationId = fooAddress.Id,
            InstanceId = fooInstance.Id,
            InstanceType = "EcsInstance",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/eip"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooZones, err := ecs.Zones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		fooImages, err := ecs.Images(ctx, &ecs.ImagesArgs{
    			OsType:         pulumi.StringRef("Linux"),
    			Visibility:     pulumi.StringRef("public"),
    			InstanceTypeId: pulumi.StringRef("ecs.g1.large"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
    			VpcName:   pulumi.String("acc-test-vpc"),
    			CidrBlock: pulumi.String("172.16.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
    			SubnetName: pulumi.String("acc-test-subnet"),
    			CidrBlock:  pulumi.String("172.16.0.0/24"),
    			ZoneId:     *pulumi.String(fooZones.Zones[0].Id),
    			VpcId:      fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		fooSecurityGroup, err := vpc.NewSecurityGroup(ctx, "fooSecurityGroup", &vpc.SecurityGroupArgs{
    			VpcId:             fooVpc.ID(),
    			SecurityGroupName: pulumi.String("acc-test-security-group"),
    		})
    		if err != nil {
    			return err
    		}
    		fooInstance, err := ecs.NewInstance(ctx, "fooInstance", &ecs.InstanceArgs{
    			ImageId:            *pulumi.String(fooImages.Images[0].ImageId),
    			InstanceType:       pulumi.String("ecs.g1.large"),
    			InstanceName:       pulumi.String("acc-test-ecs-name"),
    			Password:           pulumi.String("93f0cb0614Aab12"),
    			InstanceChargeType: pulumi.String("PostPaid"),
    			SystemVolumeType:   pulumi.String("ESSD_PL0"),
    			SystemVolumeSize:   pulumi.Int(40),
    			SubnetId:           fooSubnet.ID(),
    			SecurityGroupIds: pulumi.StringArray{
    				fooSecurityGroup.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fooAddress, err := eip.NewAddress(ctx, "fooAddress", &eip.AddressArgs{
    			BillingType: pulumi.String("PostPaidByTraffic"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = eip.NewAssociate(ctx, "fooAssociate", &eip.AssociateArgs{
    			AllocationId: fooAddress.ID(),
    			InstanceId:   fooInstance.ID(),
    			InstanceType: pulumi.String("EcsInstance"),
    		})
    		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.volcengine.ecs.EcsFunctions;
    import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
    import com.pulumi.volcengine.ecs.inputs.ImagesArgs;
    import com.pulumi.volcengine.vpc.Vpc;
    import com.pulumi.volcengine.vpc.VpcArgs;
    import com.pulumi.volcengine.vpc.Subnet;
    import com.pulumi.volcengine.vpc.SubnetArgs;
    import com.pulumi.volcengine.vpc.SecurityGroup;
    import com.pulumi.volcengine.vpc.SecurityGroupArgs;
    import com.pulumi.volcengine.ecs.Instance;
    import com.pulumi.volcengine.ecs.InstanceArgs;
    import com.pulumi.volcengine.eip.Address;
    import com.pulumi.volcengine.eip.AddressArgs;
    import com.pulumi.volcengine.eip.Associate;
    import com.pulumi.volcengine.eip.AssociateArgs;
    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 fooZones = EcsFunctions.Zones();
    
            final var fooImages = EcsFunctions.Images(ImagesArgs.builder()
                .osType("Linux")
                .visibility("public")
                .instanceTypeId("ecs.g1.large")
                .build());
    
            var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
                .vpcName("acc-test-vpc")
                .cidrBlock("172.16.0.0/16")
                .build());
    
            var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
                .subnetName("acc-test-subnet")
                .cidrBlock("172.16.0.0/24")
                .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .vpcId(fooVpc.id())
                .build());
    
            var fooSecurityGroup = new SecurityGroup("fooSecurityGroup", SecurityGroupArgs.builder()        
                .vpcId(fooVpc.id())
                .securityGroupName("acc-test-security-group")
                .build());
    
            var fooInstance = new Instance("fooInstance", InstanceArgs.builder()        
                .imageId(fooImages.applyValue(imagesResult -> imagesResult.images()[0].imageId()))
                .instanceType("ecs.g1.large")
                .instanceName("acc-test-ecs-name")
                .password("93f0cb0614Aab12")
                .instanceChargeType("PostPaid")
                .systemVolumeType("ESSD_PL0")
                .systemVolumeSize(40)
                .subnetId(fooSubnet.id())
                .securityGroupIds(fooSecurityGroup.id())
                .build());
    
            var fooAddress = new Address("fooAddress", AddressArgs.builder()        
                .billingType("PostPaidByTraffic")
                .build());
    
            var fooAssociate = new Associate("fooAssociate", AssociateArgs.builder()        
                .allocationId(fooAddress.id())
                .instanceId(fooInstance.id())
                .instanceType("EcsInstance")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_zones = volcengine.ecs.zones()
    foo_images = volcengine.ecs.images(os_type="Linux",
        visibility="public",
        instance_type_id="ecs.g1.large")
    foo_vpc = volcengine.vpc.Vpc("fooVpc",
        vpc_name="acc-test-vpc",
        cidr_block="172.16.0.0/16")
    foo_subnet = volcengine.vpc.Subnet("fooSubnet",
        subnet_name="acc-test-subnet",
        cidr_block="172.16.0.0/24",
        zone_id=foo_zones.zones[0].id,
        vpc_id=foo_vpc.id)
    foo_security_group = volcengine.vpc.SecurityGroup("fooSecurityGroup",
        vpc_id=foo_vpc.id,
        security_group_name="acc-test-security-group")
    foo_instance = volcengine.ecs.Instance("fooInstance",
        image_id=foo_images.images[0].image_id,
        instance_type="ecs.g1.large",
        instance_name="acc-test-ecs-name",
        password="93f0cb0614Aab12",
        instance_charge_type="PostPaid",
        system_volume_type="ESSD_PL0",
        system_volume_size=40,
        subnet_id=foo_subnet.id,
        security_group_ids=[foo_security_group.id])
    foo_address = volcengine.eip.Address("fooAddress", billing_type="PostPaidByTraffic")
    foo_associate = volcengine.eip.Associate("fooAssociate",
        allocation_id=foo_address.id,
        instance_id=foo_instance.id,
        instance_type="EcsInstance")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooZones = volcengine.ecs.Zones({});
    const fooImages = volcengine.ecs.Images({
        osType: "Linux",
        visibility: "public",
        instanceTypeId: "ecs.g1.large",
    });
    const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
        vpcName: "acc-test-vpc",
        cidrBlock: "172.16.0.0/16",
    });
    const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
        subnetName: "acc-test-subnet",
        cidrBlock: "172.16.0.0/24",
        zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        vpcId: fooVpc.id,
    });
    const fooSecurityGroup = new volcengine.vpc.SecurityGroup("fooSecurityGroup", {
        vpcId: fooVpc.id,
        securityGroupName: "acc-test-security-group",
    });
    const fooInstance = new volcengine.ecs.Instance("fooInstance", {
        imageId: fooImages.then(fooImages => fooImages.images?.[0]?.imageId),
        instanceType: "ecs.g1.large",
        instanceName: "acc-test-ecs-name",
        password: "93f0cb0614Aab12",
        instanceChargeType: "PostPaid",
        systemVolumeType: "ESSD_PL0",
        systemVolumeSize: 40,
        subnetId: fooSubnet.id,
        securityGroupIds: [fooSecurityGroup.id],
    });
    const fooAddress = new volcengine.eip.Address("fooAddress", {billingType: "PostPaidByTraffic"});
    const fooAssociate = new volcengine.eip.Associate("fooAssociate", {
        allocationId: fooAddress.id,
        instanceId: fooInstance.id,
        instanceType: "EcsInstance",
    });
    
    resources:
      fooVpc:
        type: volcengine:vpc:Vpc
        properties:
          vpcName: acc-test-vpc
          cidrBlock: 172.16.0.0/16
      fooSubnet:
        type: volcengine:vpc:Subnet
        properties:
          subnetName: acc-test-subnet
          cidrBlock: 172.16.0.0/24
          zoneId: ${fooZones.zones[0].id}
          vpcId: ${fooVpc.id}
      fooSecurityGroup:
        type: volcengine:vpc:SecurityGroup
        properties:
          vpcId: ${fooVpc.id}
          securityGroupName: acc-test-security-group
      fooInstance:
        type: volcengine:ecs:Instance
        properties:
          imageId: ${fooImages.images[0].imageId}
          instanceType: ecs.g1.large
          instanceName: acc-test-ecs-name
          password: 93f0cb0614Aab12
          instanceChargeType: PostPaid
          systemVolumeType: ESSD_PL0
          systemVolumeSize: 40
          subnetId: ${fooSubnet.id}
          securityGroupIds:
            - ${fooSecurityGroup.id}
      fooAddress:
        type: volcengine:eip:Address
        properties:
          billingType: PostPaidByTraffic
      fooAssociate:
        type: volcengine:eip:Associate
        properties:
          allocationId: ${fooAddress.id}
          instanceId: ${fooInstance.id}
          instanceType: EcsInstance
    variables:
      fooZones:
        fn::invoke:
          Function: volcengine:ecs:Zones
          Arguments: {}
      fooImages:
        fn::invoke:
          Function: volcengine:ecs:Images
          Arguments:
            osType: Linux
            visibility: public
            instanceTypeId: ecs.g1.large
    

    Create Associate Resource

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

    Constructor syntax

    new Associate(name: string, args: AssociateArgs, opts?: CustomResourceOptions);
    @overload
    def Associate(resource_name: str,
                  args: AssociateArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Associate(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  allocation_id: Optional[str] = None,
                  instance_id: Optional[str] = None,
                  instance_type: Optional[str] = None,
                  private_ip_address: Optional[str] = None)
    func NewAssociate(ctx *Context, name string, args AssociateArgs, opts ...ResourceOption) (*Associate, error)
    public Associate(string name, AssociateArgs args, CustomResourceOptions? opts = null)
    public Associate(String name, AssociateArgs args)
    public Associate(String name, AssociateArgs args, CustomResourceOptions options)
    
    type: volcengine:eip:Associate
    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 AssociateArgs
    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 AssociateArgs
    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 AssociateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AssociateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AssociateArgs
    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 associateResource = new Volcengine.Eip.Associate("associateResource", new()
    {
        AllocationId = "string",
        InstanceId = "string",
        InstanceType = "string",
        PrivateIpAddress = "string",
    });
    
    example, err := eip.NewAssociate(ctx, "associateResource", &eip.AssociateArgs{
    	AllocationId:     pulumi.String("string"),
    	InstanceId:       pulumi.String("string"),
    	InstanceType:     pulumi.String("string"),
    	PrivateIpAddress: pulumi.String("string"),
    })
    
    var associateResource = new Associate("associateResource", AssociateArgs.builder()
        .allocationId("string")
        .instanceId("string")
        .instanceType("string")
        .privateIpAddress("string")
        .build());
    
    associate_resource = volcengine.eip.Associate("associateResource",
        allocation_id="string",
        instance_id="string",
        instance_type="string",
        private_ip_address="string")
    
    const associateResource = new volcengine.eip.Associate("associateResource", {
        allocationId: "string",
        instanceId: "string",
        instanceType: "string",
        privateIpAddress: "string",
    });
    
    type: volcengine:eip:Associate
    properties:
        allocationId: string
        instanceId: string
        instanceType: string
        privateIpAddress: string
    

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

    AllocationId string
    The allocation id of the EIP.
    InstanceId string
    The instance id which be associated to the EIP.
    InstanceType string
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    PrivateIpAddress string
    The private IP address of the instance will be associated to the EIP.
    AllocationId string
    The allocation id of the EIP.
    InstanceId string
    The instance id which be associated to the EIP.
    InstanceType string
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    PrivateIpAddress string
    The private IP address of the instance will be associated to the EIP.
    allocationId String
    The allocation id of the EIP.
    instanceId String
    The instance id which be associated to the EIP.
    instanceType String
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    privateIpAddress String
    The private IP address of the instance will be associated to the EIP.
    allocationId string
    The allocation id of the EIP.
    instanceId string
    The instance id which be associated to the EIP.
    instanceType string
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    privateIpAddress string
    The private IP address of the instance will be associated to the EIP.
    allocation_id str
    The allocation id of the EIP.
    instance_id str
    The instance id which be associated to the EIP.
    instance_type str
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    private_ip_address str
    The private IP address of the instance will be associated to the EIP.
    allocationId String
    The allocation id of the EIP.
    instanceId String
    The instance id which be associated to the EIP.
    instanceType String
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    privateIpAddress String
    The private IP address of the instance will be associated to the EIP.

    Outputs

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

    Get an existing Associate 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?: AssociateState, opts?: CustomResourceOptions): Associate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allocation_id: Optional[str] = None,
            instance_id: Optional[str] = None,
            instance_type: Optional[str] = None,
            private_ip_address: Optional[str] = None) -> Associate
    func GetAssociate(ctx *Context, name string, id IDInput, state *AssociateState, opts ...ResourceOption) (*Associate, error)
    public static Associate Get(string name, Input<string> id, AssociateState? state, CustomResourceOptions? opts = null)
    public static Associate get(String name, Output<String> id, AssociateState 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:
    AllocationId string
    The allocation id of the EIP.
    InstanceId string
    The instance id which be associated to the EIP.
    InstanceType string
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    PrivateIpAddress string
    The private IP address of the instance will be associated to the EIP.
    AllocationId string
    The allocation id of the EIP.
    InstanceId string
    The instance id which be associated to the EIP.
    InstanceType string
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    PrivateIpAddress string
    The private IP address of the instance will be associated to the EIP.
    allocationId String
    The allocation id of the EIP.
    instanceId String
    The instance id which be associated to the EIP.
    instanceType String
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    privateIpAddress String
    The private IP address of the instance will be associated to the EIP.
    allocationId string
    The allocation id of the EIP.
    instanceId string
    The instance id which be associated to the EIP.
    instanceType string
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    privateIpAddress string
    The private IP address of the instance will be associated to the EIP.
    allocation_id str
    The allocation id of the EIP.
    instance_id str
    The instance id which be associated to the EIP.
    instance_type str
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    private_ip_address str
    The private IP address of the instance will be associated to the EIP.
    allocationId String
    The allocation id of the EIP.
    instanceId String
    The instance id which be associated to the EIP.
    instanceType String
    The type of the associated instance,the value is Nat or NetworkInterface or ClbInstance or EcsInstance or HaVip.
    privateIpAddress String
    The private IP address of the instance will be associated to the EIP.

    Import

    Eip associate can be imported using the eip allocation_id:instance_id, e.g.

     $ pulumi import volcengine:eip/associate:Associate default eip-274oj9a8rs9a87fap8sf9515b:i-cm9t9ug9lggu79yr5tcw
    

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

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.25 published on Tuesday, Jul 2, 2024 by Volcengine