alicloud.databasefilesystem.InstanceAttachment
Explore with Pulumi AI
Provides a DBFS Instance Attachment resource.
For information about DBFS Instance Attachment and how to use it.
NOTE: Available since v1.156.0.
Example Usage
Basic Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var zoneId = "cn-hangzhou-i";
var exampleInstanceTypes = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
{
AvailabilityZone = zoneId,
InstanceTypeFamily = "ecs.g7se",
});
var exampleImages = AliCloud.Ecs.GetImages.Invoke(new()
{
InstanceType = exampleInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes)[exampleInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes).Length - 1].Id,
NameRegex = "^aliyun_2",
Owners = "system",
});
var exampleNetwork = new AliCloud.Vpc.Network("exampleNetwork", new()
{
VpcName = name,
CidrBlock = "10.4.0.0/16",
});
var exampleSwitch = new AliCloud.Vpc.Switch("exampleSwitch", new()
{
VswitchName = name,
CidrBlock = "10.4.0.0/24",
VpcId = exampleNetwork.Id,
ZoneId = zoneId,
});
var exampleSecurityGroup = new AliCloud.Ecs.SecurityGroup("exampleSecurityGroup", new()
{
VpcId = exampleNetwork.Id,
});
var exampleInstance = new AliCloud.Ecs.Instance("exampleInstance", new()
{
AvailabilityZone = zoneId,
InstanceName = name,
ImageId = exampleImages.Apply(getImagesResult => getImagesResult.Images[1]?.Id),
InstanceType = Output.Tuple(exampleInstanceTypes, exampleInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes).Length).Apply(values =>
{
var exampleInstanceTypes = values.Item1;
var length = values.Item2;
return exampleInstanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes)[length - 1].Id;
}),
SecurityGroups = new[]
{
exampleSecurityGroup.Id,
},
VswitchId = exampleSwitch.Id,
SystemDiskCategory = "cloud_essd",
});
var exampleDatabasefilesystem_instanceInstance = new AliCloud.DatabaseFilesystem.Instance("exampleDatabasefilesystem/instanceInstance", new()
{
Category = "standard",
ZoneId = zoneId,
PerformanceLevel = "PL1",
InstanceName = name,
Size = 100,
});
var exampleInstanceAttachment = new AliCloud.DatabaseFilesystem.InstanceAttachment("exampleInstanceAttachment", new()
{
EcsId = exampleInstance.Id,
InstanceId = exampleDatabasefilesystem / instanceInstance.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/databasefilesystem"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"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-example"
if param := cfg.Get("name"); param != "" {
name = param
}
zoneId := "cn-hangzhou-i"
exampleInstanceTypes, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
AvailabilityZone: pulumi.StringRef(zoneId),
InstanceTypeFamily: pulumi.StringRef("ecs.g7se"),
}, nil)
if err != nil {
return err
}
exampleImages, err := ecs.GetImages(ctx, &ecs.GetImagesArgs{
InstanceType: pulumi.StringRef(exampleInstanceTypes.InstanceTypes[len(exampleInstanceTypes.InstanceTypes)-1].Id),
NameRegex: pulumi.StringRef("^aliyun_2"),
Owners: pulumi.StringRef("system"),
}, nil)
if err != nil {
return err
}
exampleNetwork, err := vpc.NewNetwork(ctx, "exampleNetwork", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/16"),
})
if err != nil {
return err
}
exampleSwitch, err := vpc.NewSwitch(ctx, "exampleSwitch", &vpc.SwitchArgs{
VswitchName: pulumi.String(name),
CidrBlock: pulumi.String("10.4.0.0/24"),
VpcId: exampleNetwork.ID(),
ZoneId: pulumi.String(zoneId),
})
if err != nil {
return err
}
exampleSecurityGroup, err := ecs.NewSecurityGroup(ctx, "exampleSecurityGroup", &ecs.SecurityGroupArgs{
VpcId: exampleNetwork.ID(),
})
if err != nil {
return err
}
exampleInstance, err := ecs.NewInstance(ctx, "exampleInstance", &ecs.InstanceArgs{
AvailabilityZone: pulumi.String(zoneId),
InstanceName: pulumi.String(name),
ImageId: *pulumi.String(exampleImages.Images[1].Id),
InstanceType: exampleInstanceTypes.InstanceTypes[len(exampleInstanceTypes.InstanceTypes)-1].Id,
SecurityGroups: pulumi.StringArray{
exampleSecurityGroup.ID(),
},
VswitchId: exampleSwitch.ID(),
SystemDiskCategory: pulumi.String("cloud_essd"),
})
if err != nil {
return err
}
_, err = databasefilesystem.NewInstance(ctx, "exampleDatabasefilesystem/instanceInstance", &databasefilesystem.InstanceArgs{
Category: pulumi.String("standard"),
ZoneId: pulumi.String(zoneId),
PerformanceLevel: pulumi.String("PL1"),
InstanceName: pulumi.String(name),
Size: pulumi.Int(100),
})
if err != nil {
return err
}
_, err = databasefilesystem.NewInstanceAttachment(ctx, "exampleInstanceAttachment", &databasefilesystem.InstanceAttachmentArgs{
EcsId: exampleInstance.ID(),
InstanceId: exampleDatabasefilesystem / instanceInstance.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.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.ecs.inputs.GetImagesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.ecs.SecurityGroup;
import com.pulumi.alicloud.ecs.SecurityGroupArgs;
import com.pulumi.alicloud.ecs.Instance;
import com.pulumi.alicloud.ecs.InstanceArgs;
import com.pulumi.alicloud.databasefilesystem.Instance;
import com.pulumi.alicloud.databasefilesystem.InstanceArgs;
import com.pulumi.alicloud.databasefilesystem.InstanceAttachment;
import com.pulumi.alicloud.databasefilesystem.InstanceAttachmentArgs;
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 config = ctx.config();
final var name = config.get("name").orElse("tf-example");
final var zoneId = "cn-hangzhou-i";
final var exampleInstanceTypes = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.availabilityZone(zoneId)
.instanceTypeFamily("ecs.g7se")
.build());
final var exampleImages = EcsFunctions.getImages(GetImagesArgs.builder()
.instanceType(exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes())[exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()).length() - 1].id())
.nameRegex("^aliyun_2")
.owners("system")
.build());
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/24")
.vpcId(exampleNetwork.id())
.zoneId(zoneId)
.build());
var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
.vpcId(exampleNetwork.id())
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.availabilityZone(zoneId)
.instanceName(name)
.imageId(exampleImages.applyValue(getImagesResult -> getImagesResult.images()[1].id()))
.instanceType(exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes())[exampleInstanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()).length() - 1].id())
.securityGroups(exampleSecurityGroup.id())
.vswitchId(exampleSwitch.id())
.systemDiskCategory("cloud_essd")
.build());
var exampleDatabasefilesystem_instanceInstance = new Instance("exampleDatabasefilesystem/instanceInstance", InstanceArgs.builder()
.category("standard")
.zoneId(zoneId)
.performanceLevel("PL1")
.instanceName(name)
.size(100)
.build());
var exampleInstanceAttachment = new InstanceAttachment("exampleInstanceAttachment", InstanceAttachmentArgs.builder()
.ecsId(exampleInstance.id())
.instanceId(exampleDatabasefilesystem / instanceInstance.id())
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
zone_id = "cn-hangzhou-i"
example_instance_types = alicloud.ecs.get_instance_types(availability_zone=zone_id,
instance_type_family="ecs.g7se")
example_images = alicloud.ecs.get_images(instance_type=example_instance_types.instance_types[len(example_instance_types.instance_types) - 1].id,
name_regex="^aliyun_2",
owners="system")
example_network = alicloud.vpc.Network("exampleNetwork",
vpc_name=name,
cidr_block="10.4.0.0/16")
example_switch = alicloud.vpc.Switch("exampleSwitch",
vswitch_name=name,
cidr_block="10.4.0.0/24",
vpc_id=example_network.id,
zone_id=zone_id)
example_security_group = alicloud.ecs.SecurityGroup("exampleSecurityGroup", vpc_id=example_network.id)
example_instance = alicloud.ecs.Instance("exampleInstance",
availability_zone=zone_id,
instance_name=name,
image_id=example_images.images[1].id,
instance_type=example_instance_types.instance_types[len(example_instance_types.instance_types) - 1].id,
security_groups=[example_security_group.id],
vswitch_id=example_switch.id,
system_disk_category="cloud_essd")
example_databasefilesystem_instance_instance = alicloud.databasefilesystem.Instance("exampleDatabasefilesystem/instanceInstance",
category="standard",
zone_id=zone_id,
performance_level="PL1",
instance_name=name,
size=100)
example_instance_attachment = alicloud.databasefilesystem.InstanceAttachment("exampleInstanceAttachment",
ecs_id=example_instance.id,
instance_id=example_databasefilesystem / instance_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-example";
const zoneId = "cn-hangzhou-i";
const exampleInstanceTypes = alicloud.ecs.getInstanceTypes({
availabilityZone: zoneId,
instanceTypeFamily: "ecs.g7se",
});
const exampleImages = Promise.all([exampleInstanceTypes, exampleInstanceTypes.then(exampleInstanceTypes => exampleInstanceTypes.instanceTypes).length]).then(([exampleInstanceTypes, length]) => alicloud.ecs.getImages({
instanceType: exampleInstanceTypes.instanceTypes[length - 1].id,
nameRegex: "^aliyun_2",
owners: "system",
}));
const exampleNetwork = new alicloud.vpc.Network("exampleNetwork", {
vpcName: name,
cidrBlock: "10.4.0.0/16",
});
const exampleSwitch = new alicloud.vpc.Switch("exampleSwitch", {
vswitchName: name,
cidrBlock: "10.4.0.0/24",
vpcId: exampleNetwork.id,
zoneId: zoneId,
});
const exampleSecurityGroup = new alicloud.ecs.SecurityGroup("exampleSecurityGroup", {vpcId: exampleNetwork.id});
const exampleInstance = new alicloud.ecs.Instance("exampleInstance", {
availabilityZone: zoneId,
instanceName: name,
imageId: exampleImages.then(exampleImages => exampleImages.images?.[1]?.id),
instanceType: Promise.all([exampleInstanceTypes, exampleInstanceTypes.then(exampleInstanceTypes => exampleInstanceTypes.instanceTypes).length]).then(([exampleInstanceTypes, length]) => exampleInstanceTypes.instanceTypes[length - 1].id),
securityGroups: [exampleSecurityGroup.id],
vswitchId: exampleSwitch.id,
systemDiskCategory: "cloud_essd",
});
const exampleDatabasefilesystem_instanceInstance = new alicloud.databasefilesystem.Instance("exampleDatabasefilesystem/instanceInstance", {
category: "standard",
zoneId: zoneId,
performanceLevel: "PL1",
instanceName: name,
size: 100,
});
const exampleInstanceAttachment = new alicloud.databasefilesystem.InstanceAttachment("exampleInstanceAttachment", {
ecsId: exampleInstance.id,
instanceId: exampleDatabasefilesystem / instanceInstance.id,
});
Coming soon!
Create InstanceAttachment Resource
new InstanceAttachment(name: string, args: InstanceAttachmentArgs, opts?: CustomResourceOptions);
@overload
def InstanceAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
ecs_id: Optional[str] = None,
instance_id: Optional[str] = None)
@overload
def InstanceAttachment(resource_name: str,
args: InstanceAttachmentArgs,
opts: Optional[ResourceOptions] = None)
func NewInstanceAttachment(ctx *Context, name string, args InstanceAttachmentArgs, opts ...ResourceOption) (*InstanceAttachment, error)
public InstanceAttachment(string name, InstanceAttachmentArgs args, CustomResourceOptions? opts = null)
public InstanceAttachment(String name, InstanceAttachmentArgs args)
public InstanceAttachment(String name, InstanceAttachmentArgs args, CustomResourceOptions options)
type: alicloud:databasefilesystem:InstanceAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args InstanceAttachmentArgs
- 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 InstanceAttachmentArgs
- 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 InstanceAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args InstanceAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args InstanceAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
InstanceAttachment 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 InstanceAttachment resource accepts the following input properties:
- Ecs
Id string The ID of the ECS instance.
- Instance
Id string The ID of the database file system.
- Ecs
Id string The ID of the ECS instance.
- Instance
Id string The ID of the database file system.
- ecs
Id String The ID of the ECS instance.
- instance
Id String The ID of the database file system.
- ecs
Id string The ID of the ECS instance.
- instance
Id string The ID of the database file system.
- ecs_
id str The ID of the ECS instance.
- instance_
id str The ID of the database file system.
- ecs
Id String The ID of the ECS instance.
- instance
Id String The ID of the database file system.
Outputs
All input properties are implicitly available as output properties. Additionally, the InstanceAttachment resource produces the following output properties:
Look up Existing InstanceAttachment Resource
Get an existing InstanceAttachment 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?: InstanceAttachmentState, opts?: CustomResourceOptions): InstanceAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
ecs_id: Optional[str] = None,
instance_id: Optional[str] = None,
status: Optional[str] = None) -> InstanceAttachment
func GetInstanceAttachment(ctx *Context, name string, id IDInput, state *InstanceAttachmentState, opts ...ResourceOption) (*InstanceAttachment, error)
public static InstanceAttachment Get(string name, Input<string> id, InstanceAttachmentState? state, CustomResourceOptions? opts = null)
public static InstanceAttachment get(String name, Output<String> id, InstanceAttachmentState 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.
- Ecs
Id string The ID of the ECS instance.
- Instance
Id string The ID of the database file system.
- Status string
The status of Database file system. Valid values:
attached
,attaching
,unattached
,detaching
.
- Ecs
Id string The ID of the ECS instance.
- Instance
Id string The ID of the database file system.
- Status string
The status of Database file system. Valid values:
attached
,attaching
,unattached
,detaching
.
- ecs
Id String The ID of the ECS instance.
- instance
Id String The ID of the database file system.
- status String
The status of Database file system. Valid values:
attached
,attaching
,unattached
,detaching
.
- ecs
Id string The ID of the ECS instance.
- instance
Id string The ID of the database file system.
- status string
The status of Database file system. Valid values:
attached
,attaching
,unattached
,detaching
.
- ecs_
id str The ID of the ECS instance.
- instance_
id str The ID of the database file system.
- status str
The status of Database file system. Valid values:
attached
,attaching
,unattached
,detaching
.
- ecs
Id String The ID of the ECS instance.
- instance
Id String The ID of the database file system.
- status String
The status of Database file system. Valid values:
attached
,attaching
,unattached
,detaching
.
Import
DBFS Instance Attachment can be imported using the id, e.g.
$ pulumi import alicloud:databasefilesystem/instanceAttachment:InstanceAttachment example <instance_id>:<ecs_id>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.