tencentcloud.EniAttachment
Explore with Pulumi AI
Provides a resource to detailed information of attached backend server to an ENI.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const images = tencentcloud.getImages({
imageTypes: ["PUBLIC_IMAGE"],
osName: "centos",
});
const instanceTypes = tencentcloud.getInstanceTypes({
filters: [{
name: "instance-family",
values: ["S3"],
}],
cpuCoreCount: 1,
memorySize: 1,
});
const zones = tencentcloud.getAvailabilityZones({});
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
const subnet = new tencentcloud.Subnet("subnet", {
availabilityZone: "ap-guangzhou-3",
vpcId: vpc.vpcId,
cidrBlock: "10.0.0.0/16",
isMulticast: false,
});
const eni = new tencentcloud.Eni("eni", {
vpcId: vpc.vpcId,
subnetId: subnet.subnetId,
description: "eni desc",
ipv4Count: 1,
});
const exampleInstance = new tencentcloud.Instance("exampleInstance", {
instanceName: "ci-test-eni-attach",
availabilityZone: zones.then(zones => zones.zones?.[0]?.name),
imageId: images.then(images => images.images?.[0]?.imageId),
instanceType: instanceTypes.then(instanceTypes => instanceTypes.instanceTypes?.[0]?.instanceType),
systemDiskType: "CLOUD_PREMIUM",
disableSecurityService: true,
disableMonitorService: true,
vpcId: vpc.vpcId,
subnetId: subnet.subnetId,
});
const exampleEniAttachment = new tencentcloud.EniAttachment("exampleEniAttachment", {
eniId: eni.eniId,
instanceId: exampleInstance.instanceId,
});
import pulumi
import pulumi_tencentcloud as tencentcloud
images = tencentcloud.get_images(image_types=["PUBLIC_IMAGE"],
os_name="centos")
instance_types = tencentcloud.get_instance_types(filters=[{
"name": "instance-family",
"values": ["S3"],
}],
cpu_core_count=1,
memory_size=1)
zones = tencentcloud.get_availability_zones()
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
subnet = tencentcloud.Subnet("subnet",
availability_zone="ap-guangzhou-3",
vpc_id=vpc.vpc_id,
cidr_block="10.0.0.0/16",
is_multicast=False)
eni = tencentcloud.Eni("eni",
vpc_id=vpc.vpc_id,
subnet_id=subnet.subnet_id,
description="eni desc",
ipv4_count=1)
example_instance = tencentcloud.Instance("exampleInstance",
instance_name="ci-test-eni-attach",
availability_zone=zones.zones[0].name,
image_id=images.images[0].image_id,
instance_type=instance_types.instance_types[0].instance_type,
system_disk_type="CLOUD_PREMIUM",
disable_security_service=True,
disable_monitor_service=True,
vpc_id=vpc.vpc_id,
subnet_id=subnet.subnet_id)
example_eni_attachment = tencentcloud.EniAttachment("exampleEniAttachment",
eni_id=eni.eni_id,
instance_id=example_instance.instance_id)
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 {
images, err := tencentcloud.GetImages(ctx, &tencentcloud.GetImagesArgs{
ImageTypes: []string{
"PUBLIC_IMAGE",
},
OsName: pulumi.StringRef("centos"),
}, nil)
if err != nil {
return err
}
instanceTypes, err := tencentcloud.GetInstanceTypes(ctx, &tencentcloud.GetInstanceTypesArgs{
Filters: []tencentcloud.GetInstanceTypesFilter{
{
Name: "instance-family",
Values: []string{
"S3",
},
},
},
CpuCoreCount: pulumi.Float64Ref(1),
MemorySize: pulumi.Float64Ref(1),
}, nil)
if err != nil {
return err
}
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("ap-guangzhou-3"),
VpcId: vpc.VpcId,
CidrBlock: pulumi.String("10.0.0.0/16"),
IsMulticast: pulumi.Bool(false),
})
if err != nil {
return err
}
eni, err := tencentcloud.NewEni(ctx, "eni", &tencentcloud.EniArgs{
VpcId: vpc.VpcId,
SubnetId: subnet.SubnetId,
Description: pulumi.String("eni desc"),
Ipv4Count: pulumi.Float64(1),
})
if err != nil {
return err
}
exampleInstance, err := tencentcloud.NewInstance(ctx, "exampleInstance", &tencentcloud.InstanceArgs{
InstanceName: pulumi.String("ci-test-eni-attach"),
AvailabilityZone: pulumi.String(zones.Zones[0].Name),
ImageId: pulumi.String(images.Images[0].ImageId),
InstanceType: pulumi.String(instanceTypes.InstanceTypes[0].InstanceType),
SystemDiskType: pulumi.String("CLOUD_PREMIUM"),
DisableSecurityService: pulumi.Bool(true),
DisableMonitorService: pulumi.Bool(true),
VpcId: vpc.VpcId,
SubnetId: subnet.SubnetId,
})
if err != nil {
return err
}
_, err = tencentcloud.NewEniAttachment(ctx, "exampleEniAttachment", &tencentcloud.EniAttachmentArgs{
EniId: eni.EniId,
InstanceId: exampleInstance.InstanceId,
})
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 images = Tencentcloud.GetImages.Invoke(new()
{
ImageTypes = new[]
{
"PUBLIC_IMAGE",
},
OsName = "centos",
});
var instanceTypes = Tencentcloud.GetInstanceTypes.Invoke(new()
{
Filters = new[]
{
new Tencentcloud.Inputs.GetInstanceTypesFilterInputArgs
{
Name = "instance-family",
Values = new[]
{
"S3",
},
},
},
CpuCoreCount = 1,
MemorySize = 1,
});
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 = "ap-guangzhou-3",
VpcId = vpc.VpcId,
CidrBlock = "10.0.0.0/16",
IsMulticast = false,
});
var eni = new Tencentcloud.Eni("eni", new()
{
VpcId = vpc.VpcId,
SubnetId = subnet.SubnetId,
Description = "eni desc",
Ipv4Count = 1,
});
var exampleInstance = new Tencentcloud.Instance("exampleInstance", new()
{
InstanceName = "ci-test-eni-attach",
AvailabilityZone = zones.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Zones[0]?.Name),
ImageId = images.Apply(getImagesResult => getImagesResult.Images[0]?.ImageId),
InstanceType = instanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.InstanceType),
SystemDiskType = "CLOUD_PREMIUM",
DisableSecurityService = true,
DisableMonitorService = true,
VpcId = vpc.VpcId,
SubnetId = subnet.SubnetId,
});
var exampleEniAttachment = new Tencentcloud.EniAttachment("exampleEniAttachment", new()
{
EniId = eni.EniId,
InstanceId = exampleInstance.InstanceId,
});
});
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.GetImagesArgs;
import com.pulumi.tencentcloud.inputs.GetInstanceTypesArgs;
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.Eni;
import com.pulumi.tencentcloud.EniArgs;
import com.pulumi.tencentcloud.Instance;
import com.pulumi.tencentcloud.InstanceArgs;
import com.pulumi.tencentcloud.EniAttachment;
import com.pulumi.tencentcloud.EniAttachmentArgs;
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 images = TencentcloudFunctions.getImages(GetImagesArgs.builder()
.imageTypes("PUBLIC_IMAGE")
.osName("centos")
.build());
final var instanceTypes = TencentcloudFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.filters(GetInstanceTypesFilterArgs.builder()
.name("instance-family")
.values("S3")
.build())
.cpuCoreCount(1)
.memorySize(1)
.build());
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("ap-guangzhou-3")
.vpcId(vpc.vpcId())
.cidrBlock("10.0.0.0/16")
.isMulticast(false)
.build());
var eni = new Eni("eni", EniArgs.builder()
.vpcId(vpc.vpcId())
.subnetId(subnet.subnetId())
.description("eni desc")
.ipv4Count(1)
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.instanceName("ci-test-eni-attach")
.availabilityZone(zones.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.zones()[0].name()))
.imageId(images.applyValue(getImagesResult -> getImagesResult.images()[0].imageId()))
.instanceType(instanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].instanceType()))
.systemDiskType("CLOUD_PREMIUM")
.disableSecurityService(true)
.disableMonitorService(true)
.vpcId(vpc.vpcId())
.subnetId(subnet.subnetId())
.build());
var exampleEniAttachment = new EniAttachment("exampleEniAttachment", EniAttachmentArgs.builder()
.eniId(eni.eniId())
.instanceId(exampleInstance.instanceId())
.build());
}
}
resources:
vpc:
type: tencentcloud:Vpc
properties:
cidrBlock: 10.0.0.0/16
subnet:
type: tencentcloud:Subnet
properties:
availabilityZone: ap-guangzhou-3
vpcId: ${vpc.vpcId}
cidrBlock: 10.0.0.0/16
isMulticast: false
eni:
type: tencentcloud:Eni
properties:
vpcId: ${vpc.vpcId}
subnetId: ${subnet.subnetId}
description: eni desc
ipv4Count: 1
exampleInstance:
type: tencentcloud:Instance
properties:
instanceName: ci-test-eni-attach
availabilityZone: ${zones.zones[0].name}
imageId: ${images.images[0].imageId}
instanceType: ${instanceTypes.instanceTypes[0].instanceType}
systemDiskType: CLOUD_PREMIUM
disableSecurityService: true
disableMonitorService: true
vpcId: ${vpc.vpcId}
subnetId: ${subnet.subnetId}
exampleEniAttachment:
type: tencentcloud:EniAttachment
properties:
eniId: ${eni.eniId}
instanceId: ${exampleInstance.instanceId}
variables:
images:
fn::invoke:
function: tencentcloud:getImages
arguments:
imageTypes:
- PUBLIC_IMAGE
osName: centos
instanceTypes:
fn::invoke:
function: tencentcloud:getInstanceTypes
arguments:
filters:
- name: instance-family
values:
- S3
cpuCoreCount: 1
memorySize: 1
zones:
fn::invoke:
function: tencentcloud:getAvailabilityZones
arguments: {}
Create EniAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EniAttachment(name: string, args: EniAttachmentArgs, opts?: CustomResourceOptions);
@overload
def EniAttachment(resource_name: str,
args: EniAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EniAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
eni_id: Optional[str] = None,
instance_id: Optional[str] = None,
eni_attachment_id: Optional[str] = None)
func NewEniAttachment(ctx *Context, name string, args EniAttachmentArgs, opts ...ResourceOption) (*EniAttachment, error)
public EniAttachment(string name, EniAttachmentArgs args, CustomResourceOptions? opts = null)
public EniAttachment(String name, EniAttachmentArgs args)
public EniAttachment(String name, EniAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:EniAttachment
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 EniAttachmentArgs
- 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 EniAttachmentArgs
- 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 EniAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EniAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EniAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
EniAttachment 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 EniAttachment resource accepts the following input properties:
- Eni
Id string - ID of the ENI.
- Instance
Id string - ID of the instance which bind the ENI.
- Eni
Attachment stringId - ID of the resource.
- Eni
Id string - ID of the ENI.
- Instance
Id string - ID of the instance which bind the ENI.
- Eni
Attachment stringId - ID of the resource.
- eni
Id String - ID of the ENI.
- instance
Id String - ID of the instance which bind the ENI.
- eni
Attachment StringId - ID of the resource.
- eni
Id string - ID of the ENI.
- instance
Id string - ID of the instance which bind the ENI.
- eni
Attachment stringId - ID of the resource.
- eni_
id str - ID of the ENI.
- instance_
id str - ID of the instance which bind the ENI.
- eni_
attachment_ strid - ID of the resource.
- eni
Id String - ID of the ENI.
- instance
Id String - ID of the instance which bind the ENI.
- eni
Attachment StringId - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the EniAttachment 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 EniAttachment Resource
Get an existing EniAttachment 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?: EniAttachmentState, opts?: CustomResourceOptions): EniAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
eni_attachment_id: Optional[str] = None,
eni_id: Optional[str] = None,
instance_id: Optional[str] = None) -> EniAttachment
func GetEniAttachment(ctx *Context, name string, id IDInput, state *EniAttachmentState, opts ...ResourceOption) (*EniAttachment, error)
public static EniAttachment Get(string name, Input<string> id, EniAttachmentState? state, CustomResourceOptions? opts = null)
public static EniAttachment get(String name, Output<String> id, EniAttachmentState state, CustomResourceOptions options)
resources: _: type: tencentcloud:EniAttachment 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.
- Eni
Attachment stringId - ID of the resource.
- Eni
Id string - ID of the ENI.
- Instance
Id string - ID of the instance which bind the ENI.
- Eni
Attachment stringId - ID of the resource.
- Eni
Id string - ID of the ENI.
- Instance
Id string - ID of the instance which bind the ENI.
- eni
Attachment StringId - ID of the resource.
- eni
Id String - ID of the ENI.
- instance
Id String - ID of the instance which bind the ENI.
- eni
Attachment stringId - ID of the resource.
- eni
Id string - ID of the ENI.
- instance
Id string - ID of the instance which bind the ENI.
- eni_
attachment_ strid - ID of the resource.
- eni_
id str - ID of the ENI.
- instance_
id str - ID of the instance which bind the ENI.
- eni
Attachment StringId - ID of the resource.
- eni
Id String - ID of the ENI.
- instance
Id String - ID of the instance which bind the ENI.
Import
ENI attachment can be imported using the id, e.g.
$ pulumi import tencentcloud:index/eniAttachment:EniAttachment example eni-gtlvkjvz+ins-0h3a5new
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.