1. Packages
  2. Volcengine
  3. API Docs
  4. vpc
  5. HaVipAssociate
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

volcengine.vpc.HaVipAssociate

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

    Provides a resource to manage ha vip 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 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()
        {
            SecurityGroupName = "acc-test-sg",
            VpcId = fooVpc.Id,
        });
    
        var fooNetworkInterface = new Volcengine.Vpc.NetworkInterface("fooNetworkInterface", new()
        {
            NetworkInterfaceName = "acc-test-eni",
            Description = "acc-test",
            SubnetId = fooSubnet.Id,
            SecurityGroupIds = new[]
            {
                fooSecurityGroup.Id,
            },
            PrimaryIpAddress = "172.16.0.253",
            PortSecurityEnabled = false,
            PrivateIpAddresses = new[]
            {
                "172.16.0.2",
            },
            ProjectName = "default",
            Tags = new[]
            {
                new Volcengine.Vpc.Inputs.NetworkInterfaceTagArgs
                {
                    Key = "k1",
                    Value = "v1",
                },
            },
        });
    
        var fooHaVip = new Volcengine.Vpc.HaVip("fooHaVip", new()
        {
            HaVipName = "acc-test-ha-vip",
            Description = "acc-test",
            SubnetId = fooSubnet.Id,
            IpAddress = "172.16.0.5",
        });
    
        var fooHaVipAssociate = new Volcengine.Vpc.HaVipAssociate("fooHaVipAssociate", new()
        {
            HaVipId = fooHaVip.Id,
            InstanceType = "NetworkInterface",
            InstanceId = fooNetworkInterface.Id,
        });
    
    });
    
    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/vpc"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooZones, err := ecs.Zones(ctx, nil, 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{
    			SecurityGroupName: pulumi.String("acc-test-sg"),
    			VpcId:             fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		fooNetworkInterface, err := vpc.NewNetworkInterface(ctx, "fooNetworkInterface", &vpc.NetworkInterfaceArgs{
    			NetworkInterfaceName: pulumi.String("acc-test-eni"),
    			Description:          pulumi.String("acc-test"),
    			SubnetId:             fooSubnet.ID(),
    			SecurityGroupIds: pulumi.StringArray{
    				fooSecurityGroup.ID(),
    			},
    			PrimaryIpAddress:    pulumi.String("172.16.0.253"),
    			PortSecurityEnabled: pulumi.Bool(false),
    			PrivateIpAddresses: pulumi.StringArray{
    				pulumi.String("172.16.0.2"),
    			},
    			ProjectName: pulumi.String("default"),
    			Tags: vpc.NetworkInterfaceTagArray{
    				&vpc.NetworkInterfaceTagArgs{
    					Key:   pulumi.String("k1"),
    					Value: pulumi.String("v1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fooHaVip, err := vpc.NewHaVip(ctx, "fooHaVip", &vpc.HaVipArgs{
    			HaVipName:   pulumi.String("acc-test-ha-vip"),
    			Description: pulumi.String("acc-test"),
    			SubnetId:    fooSubnet.ID(),
    			IpAddress:   pulumi.String("172.16.0.5"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vpc.NewHaVipAssociate(ctx, "fooHaVipAssociate", &vpc.HaVipAssociateArgs{
    			HaVipId:      fooHaVip.ID(),
    			InstanceType: pulumi.String("NetworkInterface"),
    			InstanceId:   fooNetworkInterface.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.volcengine.ecs.EcsFunctions;
    import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
    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.vpc.NetworkInterface;
    import com.pulumi.volcengine.vpc.NetworkInterfaceArgs;
    import com.pulumi.volcengine.vpc.inputs.NetworkInterfaceTagArgs;
    import com.pulumi.volcengine.vpc.HaVip;
    import com.pulumi.volcengine.vpc.HaVipArgs;
    import com.pulumi.volcengine.vpc.HaVipAssociate;
    import com.pulumi.volcengine.vpc.HaVipAssociateArgs;
    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();
    
            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()        
                .securityGroupName("acc-test-sg")
                .vpcId(fooVpc.id())
                .build());
    
            var fooNetworkInterface = new NetworkInterface("fooNetworkInterface", NetworkInterfaceArgs.builder()        
                .networkInterfaceName("acc-test-eni")
                .description("acc-test")
                .subnetId(fooSubnet.id())
                .securityGroupIds(fooSecurityGroup.id())
                .primaryIpAddress("172.16.0.253")
                .portSecurityEnabled(false)
                .privateIpAddresses("172.16.0.2")
                .projectName("default")
                .tags(NetworkInterfaceTagArgs.builder()
                    .key("k1")
                    .value("v1")
                    .build())
                .build());
    
            var fooHaVip = new HaVip("fooHaVip", HaVipArgs.builder()        
                .haVipName("acc-test-ha-vip")
                .description("acc-test")
                .subnetId(fooSubnet.id())
                .ipAddress("172.16.0.5")
                .build());
    
            var fooHaVipAssociate = new HaVipAssociate("fooHaVipAssociate", HaVipAssociateArgs.builder()        
                .haVipId(fooHaVip.id())
                .instanceType("NetworkInterface")
                .instanceId(fooNetworkInterface.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_zones = volcengine.ecs.zones()
    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",
        security_group_name="acc-test-sg",
        vpc_id=foo_vpc.id)
    foo_network_interface = volcengine.vpc.NetworkInterface("fooNetworkInterface",
        network_interface_name="acc-test-eni",
        description="acc-test",
        subnet_id=foo_subnet.id,
        security_group_ids=[foo_security_group.id],
        primary_ip_address="172.16.0.253",
        port_security_enabled=False,
        private_ip_addresses=["172.16.0.2"],
        project_name="default",
        tags=[volcengine.vpc.NetworkInterfaceTagArgs(
            key="k1",
            value="v1",
        )])
    foo_ha_vip = volcengine.vpc.HaVip("fooHaVip",
        ha_vip_name="acc-test-ha-vip",
        description="acc-test",
        subnet_id=foo_subnet.id,
        ip_address="172.16.0.5")
    foo_ha_vip_associate = volcengine.vpc.HaVipAssociate("fooHaVipAssociate",
        ha_vip_id=foo_ha_vip.id,
        instance_type="NetworkInterface",
        instance_id=foo_network_interface.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooZones = volcengine.ecs.Zones({});
    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", {
        securityGroupName: "acc-test-sg",
        vpcId: fooVpc.id,
    });
    const fooNetworkInterface = new volcengine.vpc.NetworkInterface("fooNetworkInterface", {
        networkInterfaceName: "acc-test-eni",
        description: "acc-test",
        subnetId: fooSubnet.id,
        securityGroupIds: [fooSecurityGroup.id],
        primaryIpAddress: "172.16.0.253",
        portSecurityEnabled: false,
        privateIpAddresses: ["172.16.0.2"],
        projectName: "default",
        tags: [{
            key: "k1",
            value: "v1",
        }],
    });
    const fooHaVip = new volcengine.vpc.HaVip("fooHaVip", {
        haVipName: "acc-test-ha-vip",
        description: "acc-test",
        subnetId: fooSubnet.id,
        ipAddress: "172.16.0.5",
    });
    const fooHaVipAssociate = new volcengine.vpc.HaVipAssociate("fooHaVipAssociate", {
        haVipId: fooHaVip.id,
        instanceType: "NetworkInterface",
        instanceId: fooNetworkInterface.id,
    });
    
    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:
          securityGroupName: acc-test-sg
          vpcId: ${fooVpc.id}
      fooNetworkInterface:
        type: volcengine:vpc:NetworkInterface
        properties:
          networkInterfaceName: acc-test-eni
          description: acc-test
          subnetId: ${fooSubnet.id}
          securityGroupIds:
            - ${fooSecurityGroup.id}
          primaryIpAddress: 172.16.0.253
          portSecurityEnabled: false
          privateIpAddresses:
            - 172.16.0.2
          projectName: default
          tags:
            - key: k1
              value: v1
      fooHaVip:
        type: volcengine:vpc:HaVip
        properties:
          haVipName: acc-test-ha-vip
          description: acc-test
          subnetId: ${fooSubnet.id}
          ipAddress: 172.16.0.5
      fooHaVipAssociate:
        type: volcengine:vpc:HaVipAssociate
        properties:
          haVipId: ${fooHaVip.id}
          instanceType: NetworkInterface
          instanceId: ${fooNetworkInterface.id}
    variables:
      fooZones:
        fn::invoke:
          Function: volcengine:ecs:Zones
          Arguments: {}
    

    Create HaVipAssociate Resource

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

    Constructor syntax

    new HaVipAssociate(name: string, args: HaVipAssociateArgs, opts?: CustomResourceOptions);
    @overload
    def HaVipAssociate(resource_name: str,
                       args: HaVipAssociateArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def HaVipAssociate(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       ha_vip_id: Optional[str] = None,
                       instance_id: Optional[str] = None,
                       instance_type: Optional[str] = None)
    func NewHaVipAssociate(ctx *Context, name string, args HaVipAssociateArgs, opts ...ResourceOption) (*HaVipAssociate, error)
    public HaVipAssociate(string name, HaVipAssociateArgs args, CustomResourceOptions? opts = null)
    public HaVipAssociate(String name, HaVipAssociateArgs args)
    public HaVipAssociate(String name, HaVipAssociateArgs args, CustomResourceOptions options)
    
    type: volcengine:vpc:HaVipAssociate
    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 HaVipAssociateArgs
    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 HaVipAssociateArgs
    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 HaVipAssociateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HaVipAssociateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HaVipAssociateArgs
    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 haVipAssociateResource = new Volcengine.Vpc.HaVipAssociate("haVipAssociateResource", new()
    {
        HaVipId = "string",
        InstanceId = "string",
        InstanceType = "string",
    });
    
    example, err := vpc.NewHaVipAssociate(ctx, "haVipAssociateResource", &vpc.HaVipAssociateArgs{
    	HaVipId:      pulumi.String("string"),
    	InstanceId:   pulumi.String("string"),
    	InstanceType: pulumi.String("string"),
    })
    
    var haVipAssociateResource = new HaVipAssociate("haVipAssociateResource", HaVipAssociateArgs.builder()
        .haVipId("string")
        .instanceId("string")
        .instanceType("string")
        .build());
    
    ha_vip_associate_resource = volcengine.vpc.HaVipAssociate("haVipAssociateResource",
        ha_vip_id="string",
        instance_id="string",
        instance_type="string")
    
    const haVipAssociateResource = new volcengine.vpc.HaVipAssociate("haVipAssociateResource", {
        haVipId: "string",
        instanceId: "string",
        instanceType: "string",
    });
    
    type: volcengine:vpc:HaVipAssociate
    properties:
        haVipId: string
        instanceId: string
        instanceType: string
    

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

    HaVipId string
    The id of the Ha Vip.
    InstanceId string
    The id of the associated instance.
    InstanceType string
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    HaVipId string
    The id of the Ha Vip.
    InstanceId string
    The id of the associated instance.
    InstanceType string
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    haVipId String
    The id of the Ha Vip.
    instanceId String
    The id of the associated instance.
    instanceType String
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    haVipId string
    The id of the Ha Vip.
    instanceId string
    The id of the associated instance.
    instanceType string
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    ha_vip_id str
    The id of the Ha Vip.
    instance_id str
    The id of the associated instance.
    instance_type str
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    haVipId String
    The id of the Ha Vip.
    instanceId String
    The id of the associated instance.
    instanceType String
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.

    Outputs

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

    Get an existing HaVipAssociate 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?: HaVipAssociateState, opts?: CustomResourceOptions): HaVipAssociate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            ha_vip_id: Optional[str] = None,
            instance_id: Optional[str] = None,
            instance_type: Optional[str] = None) -> HaVipAssociate
    func GetHaVipAssociate(ctx *Context, name string, id IDInput, state *HaVipAssociateState, opts ...ResourceOption) (*HaVipAssociate, error)
    public static HaVipAssociate Get(string name, Input<string> id, HaVipAssociateState? state, CustomResourceOptions? opts = null)
    public static HaVipAssociate get(String name, Output<String> id, HaVipAssociateState 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:
    HaVipId string
    The id of the Ha Vip.
    InstanceId string
    The id of the associated instance.
    InstanceType string
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    HaVipId string
    The id of the Ha Vip.
    InstanceId string
    The id of the associated instance.
    InstanceType string
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    haVipId String
    The id of the Ha Vip.
    instanceId String
    The id of the associated instance.
    instanceType String
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    haVipId string
    The id of the Ha Vip.
    instanceId string
    The id of the associated instance.
    instanceType string
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    ha_vip_id str
    The id of the Ha Vip.
    instance_id str
    The id of the associated instance.
    instance_type str
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.
    haVipId String
    The id of the Ha Vip.
    instanceId String
    The id of the associated instance.
    instanceType String
    The type of the associated instance. Valid values: EcsInstance, NetworkInterface.

    Import

    HaVipAssociate can be imported using the ha_vip_id:instance_id, e.g.

     $ pulumi import volcengine:vpc/haVipAssociate:HaVipAssociate default havip-2byzv8icq1b7k2dx0eegb****:eni-2d5wv84h7onpc58ozfeeu****
    

    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.26 published on Friday, Sep 13, 2024 by Volcengine