Alibaba Cloud
EcsNetworkInterfaceAttachment
Provides a ECS Network Interface Attachment resource.
For information about ECS Network Interface Attachment and how to use it, see What is Network Interface Attachment.
NOTE: Available in v1.123.1+.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var name = config.Get("name") ?? "tf-testAcc";
var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
{
AvailableResourceCreation = "Instance",
}));
var defaultInstanceTypes = defaultZones.Apply(defaultZones => Output.Create(AliCloud.Ecs.GetInstanceTypes.InvokeAsync(new AliCloud.Ecs.GetInstanceTypesArgs
{
AvailabilityZone = defaultZones.Zones?[0]?.Id,
EniAmount = 3,
})));
var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
{
VpcName = name,
CidrBlock = "192.168.0.0/24",
});
var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
{
VswitchName = name,
CidrBlock = "192.168.0.0/24",
ZoneId = defaultZones.Apply(defaultZones => defaultZones.Zones?[0]?.Id),
VpcId = defaultNetwork.Id,
});
var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("defaultSecurityGroup", new AliCloud.Ecs.SecurityGroupArgs
{
Description = "New security group",
VpcId = defaultNetwork.Id,
});
var defaultImages = Output.Create(AliCloud.Ecs.GetImages.InvokeAsync(new AliCloud.Ecs.GetImagesArgs
{
NameRegex = "^ubuntu_[0-9]+_[0-9]+_x64*",
MostRecent = true,
Owners = "system",
}));
var defaultInstance = new AliCloud.Ecs.Instance("defaultInstance", new AliCloud.Ecs.InstanceArgs
{
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones?[0]?.Id),
InstanceName = name,
HostName = "tf-testAcc",
ImageId = defaultImages.Apply(defaultImages => defaultImages.Images?[0]?.Id),
InstanceType = defaultInstanceTypes.Apply(defaultInstanceTypes => defaultInstanceTypes.InstanceTypes?[0]?.Id),
SecurityGroups =
{
defaultSecurityGroup.Id,
},
VswitchId = defaultSwitch.Id,
});
var defaultResourceGroups = Output.Create(AliCloud.ResourceManager.GetResourceGroups.InvokeAsync(new AliCloud.ResourceManager.GetResourceGroupsArgs
{
Status = "OK",
}));
var defaultEcsNetworkInterface = new AliCloud.Ecs.EcsNetworkInterface("defaultEcsNetworkInterface", new AliCloud.Ecs.EcsNetworkInterfaceArgs
{
NetworkInterfaceName = name,
VswitchId = defaultSwitch.Id,
SecurityGroupIds =
{
defaultSecurityGroup.Id,
},
Description = "Basic test",
PrimaryIpAddress = "192.168.0.2",
Tags =
{
{ "Created", "TF" },
{ "For", "Test" },
},
ResourceGroupId = defaultResourceGroups.Apply(defaultResourceGroups => defaultResourceGroups.Ids?[0]),
});
var defaultEcsNetworkInterfaceAttachment = new AliCloud.Ecs.EcsNetworkInterfaceAttachment("defaultEcsNetworkInterfaceAttachment", new AliCloud.Ecs.EcsNetworkInterfaceAttachmentArgs
{
NetworkInterfaceId = defaultEcsNetworkInterface.Id,
InstanceId = defaultInstance.Id,
});
}
}
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf-testAcc"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultZones, err := alicloud.GetZones(ctx, &GetZonesArgs{
AvailableResourceCreation: pulumi.StringRef("Instance"),
}, nil)
if err != nil {
return err
}
defaultInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
AvailabilityZone: pulumi.StringRef(defaultZones.Zones[0].Id),
EniAmount: pulumi.IntRef(3),
}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("192.168.0.0/24"),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("192.168.0.0/24"),
ZoneId: pulumi.String(defaultZones.Zones[0].Id),
VpcId: defaultNetwork.ID(),
})
if err != nil {
return err
}
defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "defaultSecurityGroup", &ecs.SecurityGroupArgs{
Description: pulumi.String("New security group"),
VpcId: defaultNetwork.ID(),
})
if err != nil {
return err
}
defaultImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
NameRegex: pulumi.StringRef("^ubuntu_[0-9]+_[0-9]+_x64*"),
MostRecent: pulumi.BoolRef(true),
Owners: pulumi.StringRef("system"),
}, nil)
if err != nil {
return err
}
defaultInstance, err := ecs.NewInstance(ctx, "defaultInstance", &ecs.InstanceArgs{
AvailabilityZone: pulumi.String(defaultZones.Zones[0].Id),
InstanceName: pulumi.String(name),
HostName: pulumi.String("tf-testAcc"),
ImageId: pulumi.String(defaultImages.Images[0].Id),
InstanceType: pulumi.String(defaultInstanceTypes.InstanceTypes[0].Id),
SecurityGroups: pulumi.StringArray{
defaultSecurityGroup.ID(),
},
VswitchId: defaultSwitch.ID(),
})
if err != nil {
return err
}
defaultResourceGroups, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{
Status: pulumi.StringRef("OK"),
}, nil)
if err != nil {
return err
}
defaultEcsNetworkInterface, err := ecs.NewEcsNetworkInterface(ctx, "defaultEcsNetworkInterface", &ecs.EcsNetworkInterfaceArgs{
NetworkInterfaceName: pulumi.String(name),
VswitchId: defaultSwitch.ID(),
SecurityGroupIds: pulumi.StringArray{
defaultSecurityGroup.ID(),
},
Description: pulumi.String("Basic test"),
PrimaryIpAddress: pulumi.String("192.168.0.2"),
Tags: pulumi.AnyMap{
"Created": pulumi.Any("TF"),
"For": pulumi.Any("Test"),
},
ResourceGroupId: pulumi.String(defaultResourceGroups.Ids[0]),
})
if err != nil {
return err
}
_, err = ecs.NewEcsNetworkInterfaceAttachment(ctx, "defaultEcsNetworkInterfaceAttachment", &ecs.EcsNetworkInterfaceAttachmentArgs{
NetworkInterfaceId: defaultEcsNetworkInterface.ID(),
InstanceId: defaultInstance.ID(),
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-testAcc"
default_zones = alicloud.get_zones(available_resource_creation="Instance")
default_instance_types = alicloud.ecs.get_instance_types(availability_zone=default_zones.zones[0].id,
eni_amount=3)
default_network = alicloud.vpc.Network("defaultNetwork",
vpc_name=name,
cidr_block="192.168.0.0/24")
default_switch = alicloud.vpc.Switch("defaultSwitch",
vswitch_name=name,
cidr_block="192.168.0.0/24",
zone_id=default_zones.zones[0].id,
vpc_id=default_network.id)
default_security_group = alicloud.ecs.SecurityGroup("defaultSecurityGroup",
description="New security group",
vpc_id=default_network.id)
default_images = alicloud.ecs.get_images(name_regex="^ubuntu_[0-9]+_[0-9]+_x64*",
most_recent=True,
owners="system")
default_instance = alicloud.ecs.Instance("defaultInstance",
availability_zone=default_zones.zones[0].id,
instance_name=name,
host_name="tf-testAcc",
image_id=default_images.images[0].id,
instance_type=default_instance_types.instance_types[0].id,
security_groups=[default_security_group.id],
vswitch_id=default_switch.id)
default_resource_groups = alicloud.resourcemanager.get_resource_groups(status="OK")
default_ecs_network_interface = alicloud.ecs.EcsNetworkInterface("defaultEcsNetworkInterface",
network_interface_name=name,
vswitch_id=default_switch.id,
security_group_ids=[default_security_group.id],
description="Basic test",
primary_ip_address="192.168.0.2",
tags={
"Created": "TF",
"For": "Test",
},
resource_group_id=default_resource_groups.ids[0])
default_ecs_network_interface_attachment = alicloud.ecs.EcsNetworkInterfaceAttachment("defaultEcsNetworkInterfaceAttachment",
network_interface_id=default_ecs_network_interface.id,
instance_id=default_instance.id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tf-testAcc";
const defaultZones = alicloud.getZones({
availableResourceCreation: "Instance",
});
const defaultInstanceTypes = defaultZones.then(defaultZones => alicloud.ecs.getInstanceTypes({
availabilityZone: defaultZones.zones?[0]?.id,
eniAmount: 3,
}));
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {
vpcName: name,
cidrBlock: "192.168.0.0/24",
});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
vswitchName: name,
cidrBlock: "192.168.0.0/24",
zoneId: defaultZones.then(defaultZones => defaultZones.zones?[0]?.id),
vpcId: defaultNetwork.id,
});
const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("defaultSecurityGroup", {
description: "New security group",
vpcId: defaultNetwork.id,
});
const defaultImages = alicloud.ecs.getImages({
nameRegex: "^ubuntu_[0-9]+_[0-9]+_x64*",
mostRecent: true,
owners: "system",
});
const defaultInstance = new alicloud.ecs.Instance("defaultInstance", {
availabilityZone: defaultZones.then(defaultZones => defaultZones.zones?[0]?.id),
instanceName: name,
hostName: "tf-testAcc",
imageId: defaultImages.then(defaultImages => defaultImages.images?[0]?.id),
instanceType: defaultInstanceTypes.then(defaultInstanceTypes => defaultInstanceTypes.instanceTypes?[0]?.id),
securityGroups: [defaultSecurityGroup.id],
vswitchId: defaultSwitch.id,
});
const defaultResourceGroups = alicloud.resourcemanager.getResourceGroups({
status: "OK",
});
const defaultEcsNetworkInterface = new alicloud.ecs.EcsNetworkInterface("defaultEcsNetworkInterface", {
networkInterfaceName: name,
vswitchId: defaultSwitch.id,
securityGroupIds: [defaultSecurityGroup.id],
description: "Basic test",
primaryIpAddress: "192.168.0.2",
tags: {
Created: "TF",
For: "Test",
},
resourceGroupId: defaultResourceGroups.then(defaultResourceGroups => defaultResourceGroups.ids?[0]),
});
const defaultEcsNetworkInterfaceAttachment = new alicloud.ecs.EcsNetworkInterfaceAttachment("defaultEcsNetworkInterfaceAttachment", {
networkInterfaceId: defaultEcsNetworkInterface.id,
instanceId: defaultInstance.id,
});
Coming soon!
Create a EcsNetworkInterfaceAttachment Resource
new EcsNetworkInterfaceAttachment(name: string, args: EcsNetworkInterfaceAttachmentArgs, opts?: CustomResourceOptions);
@overload
def EcsNetworkInterfaceAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
network_interface_id: Optional[str] = None,
trunk_network_instance_id: Optional[str] = None,
wait_for_network_configuration_ready: Optional[bool] = None)
@overload
def EcsNetworkInterfaceAttachment(resource_name: str,
args: EcsNetworkInterfaceAttachmentArgs,
opts: Optional[ResourceOptions] = None)
func NewEcsNetworkInterfaceAttachment(ctx *Context, name string, args EcsNetworkInterfaceAttachmentArgs, opts ...ResourceOption) (*EcsNetworkInterfaceAttachment, error)
public EcsNetworkInterfaceAttachment(string name, EcsNetworkInterfaceAttachmentArgs args, CustomResourceOptions? opts = null)
public EcsNetworkInterfaceAttachment(String name, EcsNetworkInterfaceAttachmentArgs args)
public EcsNetworkInterfaceAttachment(String name, EcsNetworkInterfaceAttachmentArgs args, CustomResourceOptions options)
type: alicloud:ecs:EcsNetworkInterfaceAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EcsNetworkInterfaceAttachmentArgs
- 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 EcsNetworkInterfaceAttachmentArgs
- 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 EcsNetworkInterfaceAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EcsNetworkInterfaceAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EcsNetworkInterfaceAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
EcsNetworkInterfaceAttachment 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 EcsNetworkInterfaceAttachment resource accepts the following input properties:
- Instance
Id string The instance id.
- Network
Interface stringId The network interface id.
- Trunk
Network stringInstance Id The trunk network instance id.
- Wait
For boolNetwork Configuration Ready The wait for network configuration ready.
- Instance
Id string The instance id.
- Network
Interface stringId The network interface id.
- Trunk
Network stringInstance Id The trunk network instance id.
- Wait
For boolNetwork Configuration Ready The wait for network configuration ready.
- instance
Id String The instance id.
- network
Interface StringId The network interface id.
- trunk
Network StringInstance Id The trunk network instance id.
- wait
For BooleanNetwork Configuration Ready The wait for network configuration ready.
- instance
Id string The instance id.
- network
Interface stringId The network interface id.
- trunk
Network stringInstance Id The trunk network instance id.
- wait
For booleanNetwork Configuration Ready The wait for network configuration ready.
- instance_
id str The instance id.
- network_
interface_ strid The network interface id.
- trunk_
network_ strinstance_ id The trunk network instance id.
- wait_
for_ boolnetwork_ configuration_ ready The wait for network configuration ready.
- instance
Id String The instance id.
- network
Interface StringId The network interface id.
- trunk
Network StringInstance Id The trunk network instance id.
- wait
For BooleanNetwork Configuration Ready The wait for network configuration ready.
Outputs
All input properties are implicitly available as output properties. Additionally, the EcsNetworkInterfaceAttachment 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 an Existing EcsNetworkInterfaceAttachment Resource
Get an existing EcsNetworkInterfaceAttachment 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?: EcsNetworkInterfaceAttachmentState, opts?: CustomResourceOptions): EcsNetworkInterfaceAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
network_interface_id: Optional[str] = None,
trunk_network_instance_id: Optional[str] = None,
wait_for_network_configuration_ready: Optional[bool] = None) -> EcsNetworkInterfaceAttachment
func GetEcsNetworkInterfaceAttachment(ctx *Context, name string, id IDInput, state *EcsNetworkInterfaceAttachmentState, opts ...ResourceOption) (*EcsNetworkInterfaceAttachment, error)
public static EcsNetworkInterfaceAttachment Get(string name, Input<string> id, EcsNetworkInterfaceAttachmentState? state, CustomResourceOptions? opts = null)
public static EcsNetworkInterfaceAttachment get(String name, Output<String> id, EcsNetworkInterfaceAttachmentState 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.
- Instance
Id string The instance id.
- Network
Interface stringId The network interface id.
- Trunk
Network stringInstance Id The trunk network instance id.
- Wait
For boolNetwork Configuration Ready The wait for network configuration ready.
- Instance
Id string The instance id.
- Network
Interface stringId The network interface id.
- Trunk
Network stringInstance Id The trunk network instance id.
- Wait
For boolNetwork Configuration Ready The wait for network configuration ready.
- instance
Id String The instance id.
- network
Interface StringId The network interface id.
- trunk
Network StringInstance Id The trunk network instance id.
- wait
For BooleanNetwork Configuration Ready The wait for network configuration ready.
- instance
Id string The instance id.
- network
Interface stringId The network interface id.
- trunk
Network stringInstance Id The trunk network instance id.
- wait
For booleanNetwork Configuration Ready The wait for network configuration ready.
- instance_
id str The instance id.
- network_
interface_ strid The network interface id.
- trunk_
network_ strinstance_ id The trunk network instance id.
- wait_
for_ boolnetwork_ configuration_ ready The wait for network configuration ready.
- instance
Id String The instance id.
- network
Interface StringId The network interface id.
- trunk
Network StringInstance Id The trunk network instance id.
- wait
For BooleanNetwork Configuration Ready The wait for network configuration ready.
Import
ECS Network Interface Attachment can be imported using the id, e.g.
$ pulumi import alicloud:ecs/ecsNetworkInterfaceAttachment:EcsNetworkInterfaceAttachment example eni-abcd1234:i-abcd1234
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.