tencentcloud.TcrVpcAttachment
Explore with Pulumi AI
Use this resource to attach tcr instance with the vpc and subnet network.
Example Usage
Attach a tcr instance with vpc resource
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const vpc = tencentcloud.getVpcSubnets({
isDefault: true,
availabilityZone: _var.availability_zone,
});
const vpcId = vpc.then(vpc => vpc.instanceLists?.[0]?.vpcId);
const subnetId = vpc.then(vpc => vpc.instanceLists?.[0]?.subnetId);
const example = new tencentcloud.TcrInstance("example", {
instanceType: "basic",
deleteBucket: true,
tags: {
createdBy: "terraform",
},
});
const tcrId = example.tcrInstanceId;
const sg = tencentcloud.getSecurityGroups({
name: "default",
});
const foo = new tencentcloud.TcrVpcAttachment("foo", {
instanceId: tcrId,
vpcId: vpcId,
subnetId: subnetId,
});
import pulumi
import pulumi_tencentcloud as tencentcloud
vpc = tencentcloud.get_vpc_subnets(is_default=True,
availability_zone=var["availability_zone"])
vpc_id = vpc.instance_lists[0].vpc_id
subnet_id = vpc.instance_lists[0].subnet_id
example = tencentcloud.TcrInstance("example",
instance_type="basic",
delete_bucket=True,
tags={
"createdBy": "terraform",
})
tcr_id = example.tcr_instance_id
sg = tencentcloud.get_security_groups(name="default")
foo = tencentcloud.TcrVpcAttachment("foo",
instance_id=tcr_id,
vpc_id=vpc_id,
subnet_id=subnet_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 {
vpc, err := tencentcloud.GetVpcSubnets(ctx, &tencentcloud.GetVpcSubnetsArgs{
IsDefault: pulumi.BoolRef(true),
AvailabilityZone: pulumi.StringRef(_var.Availability_zone),
}, nil)
if err != nil {
return err
}
vpcId := vpc.InstanceLists[0].VpcId
subnetId := vpc.InstanceLists[0].SubnetId
example, err := tencentcloud.NewTcrInstance(ctx, "example", &tencentcloud.TcrInstanceArgs{
InstanceType: pulumi.String("basic"),
DeleteBucket: pulumi.Bool(true),
Tags: pulumi.StringMap{
"createdBy": pulumi.String("terraform"),
},
})
if err != nil {
return err
}
tcrId := example.TcrInstanceId
_, err = tencentcloud.GetSecurityGroups(ctx, &tencentcloud.GetSecurityGroupsArgs{
Name: pulumi.StringRef("default"),
}, nil)
if err != nil {
return err
}
_, err = tencentcloud.NewTcrVpcAttachment(ctx, "foo", &tencentcloud.TcrVpcAttachmentArgs{
InstanceId: pulumi.String(tcrId),
VpcId: pulumi.String(vpcId),
SubnetId: pulumi.String(subnetId),
})
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 vpc = Tencentcloud.GetVpcSubnets.Invoke(new()
{
IsDefault = true,
AvailabilityZone = @var.Availability_zone,
});
var vpcId = vpc.Apply(getVpcSubnetsResult => getVpcSubnetsResult.InstanceLists[0]?.VpcId);
var subnetId = vpc.Apply(getVpcSubnetsResult => getVpcSubnetsResult.InstanceLists[0]?.SubnetId);
var example = new Tencentcloud.TcrInstance("example", new()
{
InstanceType = "basic",
DeleteBucket = true,
Tags =
{
{ "createdBy", "terraform" },
},
});
var tcrId = example.TcrInstanceId;
var sg = Tencentcloud.GetSecurityGroups.Invoke(new()
{
Name = "default",
});
var foo = new Tencentcloud.TcrVpcAttachment("foo", new()
{
InstanceId = tcrId,
VpcId = vpcId,
SubnetId = subnetId,
});
});
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.GetVpcSubnetsArgs;
import com.pulumi.tencentcloud.TcrInstance;
import com.pulumi.tencentcloud.TcrInstanceArgs;
import com.pulumi.tencentcloud.inputs.GetSecurityGroupsArgs;
import com.pulumi.tencentcloud.TcrVpcAttachment;
import com.pulumi.tencentcloud.TcrVpcAttachmentArgs;
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 vpc = TencentcloudFunctions.getVpcSubnets(GetVpcSubnetsArgs.builder()
.isDefault(true)
.availabilityZone(var_.availability_zone())
.build());
final var vpcId = vpc.applyValue(getVpcSubnetsResult -> getVpcSubnetsResult.instanceLists()[0].vpcId());
final var subnetId = vpc.applyValue(getVpcSubnetsResult -> getVpcSubnetsResult.instanceLists()[0].subnetId());
var example = new TcrInstance("example", TcrInstanceArgs.builder()
.instanceType("basic")
.deleteBucket(true)
.tags(Map.of("createdBy", "terraform"))
.build());
final var tcrId = example.tcrInstanceId();
final var sg = TencentcloudFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder()
.name("default")
.build());
var foo = new TcrVpcAttachment("foo", TcrVpcAttachmentArgs.builder()
.instanceId(tcrId)
.vpcId(vpcId)
.subnetId(subnetId)
.build());
}
}
resources:
example:
type: tencentcloud:TcrInstance
properties:
instanceType: basic
deleteBucket: true
tags:
createdBy: terraform
foo:
type: tencentcloud:TcrVpcAttachment
properties:
instanceId: ${tcrId}
vpcId: ${vpcId}
subnetId: ${subnetId}
variables:
vpcId: ${vpc.instanceLists[0].vpcId}
subnetId: ${vpc.instanceLists[0].subnetId}
tcrId: ${example.tcrInstanceId}
vpc:
fn::invoke:
function: tencentcloud:getVpcSubnets
arguments:
isDefault: true
availabilityZone: ${var.availability_zone}
sg:
fn::invoke:
function: tencentcloud:getSecurityGroups
arguments:
name: default
Create TcrVpcAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new TcrVpcAttachment(name: string, args: TcrVpcAttachmentArgs, opts?: CustomResourceOptions);
@overload
def TcrVpcAttachment(resource_name: str,
args: TcrVpcAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def TcrVpcAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
enable_public_domain_dns: Optional[bool] = None,
enable_vpc_domain_dns: Optional[bool] = None,
region_id: Optional[float] = None,
region_name: Optional[str] = None,
tcr_vpc_attachment_id: Optional[str] = None)
func NewTcrVpcAttachment(ctx *Context, name string, args TcrVpcAttachmentArgs, opts ...ResourceOption) (*TcrVpcAttachment, error)
public TcrVpcAttachment(string name, TcrVpcAttachmentArgs args, CustomResourceOptions? opts = null)
public TcrVpcAttachment(String name, TcrVpcAttachmentArgs args)
public TcrVpcAttachment(String name, TcrVpcAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:TcrVpcAttachment
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 TcrVpcAttachmentArgs
- 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 TcrVpcAttachmentArgs
- 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 TcrVpcAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TcrVpcAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TcrVpcAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
TcrVpcAttachment 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 TcrVpcAttachment resource accepts the following input properties:
- Instance
Id string - ID of the TCR instance.
- Subnet
Id string - ID of subnet.
- Vpc
Id string - ID of VPC.
- Enable
Public boolDomain Dns - Whether to enable public domain dns. Default value is
false
. - Enable
Vpc boolDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - Region
Id double - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - Region
Name string - Name of region. Conflict with region_id, can not be set at the same time.
- Tcr
Vpc stringAttachment Id - ID of the resource.
- Instance
Id string - ID of the TCR instance.
- Subnet
Id string - ID of subnet.
- Vpc
Id string - ID of VPC.
- Enable
Public boolDomain Dns - Whether to enable public domain dns. Default value is
false
. - Enable
Vpc boolDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - Region
Id float64 - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - Region
Name string - Name of region. Conflict with region_id, can not be set at the same time.
- Tcr
Vpc stringAttachment Id - ID of the resource.
- instance
Id String - ID of the TCR instance.
- subnet
Id String - ID of subnet.
- vpc
Id String - ID of VPC.
- enable
Public BooleanDomain Dns - Whether to enable public domain dns. Default value is
false
. - enable
Vpc BooleanDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - region
Id Double - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region
Name String - Name of region. Conflict with region_id, can not be set at the same time.
- tcr
Vpc StringAttachment Id - ID of the resource.
- instance
Id string - ID of the TCR instance.
- subnet
Id string - ID of subnet.
- vpc
Id string - ID of VPC.
- enable
Public booleanDomain Dns - Whether to enable public domain dns. Default value is
false
. - enable
Vpc booleanDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - region
Id number - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region
Name string - Name of region. Conflict with region_id, can not be set at the same time.
- tcr
Vpc stringAttachment Id - ID of the resource.
- instance_
id str - ID of the TCR instance.
- subnet_
id str - ID of subnet.
- vpc_
id str - ID of VPC.
- enable_
public_ booldomain_ dns - Whether to enable public domain dns. Default value is
false
. - enable_
vpc_ booldomain_ dns - Whether to enable vpc domain dns. Default value is
false
. - region_
id float - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region_
name str - Name of region. Conflict with region_id, can not be set at the same time.
- tcr_
vpc_ strattachment_ id - ID of the resource.
- instance
Id String - ID of the TCR instance.
- subnet
Id String - ID of subnet.
- vpc
Id String - ID of VPC.
- enable
Public BooleanDomain Dns - Whether to enable public domain dns. Default value is
false
. - enable
Vpc BooleanDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - region
Id Number - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region
Name String - Name of region. Conflict with region_id, can not be set at the same time.
- tcr
Vpc StringAttachment Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the TcrVpcAttachment resource produces the following output properties:
Look up Existing TcrVpcAttachment Resource
Get an existing TcrVpcAttachment 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?: TcrVpcAttachmentState, opts?: CustomResourceOptions): TcrVpcAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
access_ip: Optional[str] = None,
enable_public_domain_dns: Optional[bool] = None,
enable_vpc_domain_dns: Optional[bool] = None,
instance_id: Optional[str] = None,
region_id: Optional[float] = None,
region_name: Optional[str] = None,
status: Optional[str] = None,
subnet_id: Optional[str] = None,
tcr_vpc_attachment_id: Optional[str] = None,
vpc_id: Optional[str] = None) -> TcrVpcAttachment
func GetTcrVpcAttachment(ctx *Context, name string, id IDInput, state *TcrVpcAttachmentState, opts ...ResourceOption) (*TcrVpcAttachment, error)
public static TcrVpcAttachment Get(string name, Input<string> id, TcrVpcAttachmentState? state, CustomResourceOptions? opts = null)
public static TcrVpcAttachment get(String name, Output<String> id, TcrVpcAttachmentState state, CustomResourceOptions options)
resources: _: type: tencentcloud:TcrVpcAttachment 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.
- Access
Ip string - IP address of the internal access.
- Enable
Public boolDomain Dns - Whether to enable public domain dns. Default value is
false
. - Enable
Vpc boolDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - Instance
Id string - ID of the TCR instance.
- Region
Id double - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - Region
Name string - Name of region. Conflict with region_id, can not be set at the same time.
- Status string
- Status of the internal access.
- Subnet
Id string - ID of subnet.
- Tcr
Vpc stringAttachment Id - ID of the resource.
- Vpc
Id string - ID of VPC.
- Access
Ip string - IP address of the internal access.
- Enable
Public boolDomain Dns - Whether to enable public domain dns. Default value is
false
. - Enable
Vpc boolDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - Instance
Id string - ID of the TCR instance.
- Region
Id float64 - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - Region
Name string - Name of region. Conflict with region_id, can not be set at the same time.
- Status string
- Status of the internal access.
- Subnet
Id string - ID of subnet.
- Tcr
Vpc stringAttachment Id - ID of the resource.
- Vpc
Id string - ID of VPC.
- access
Ip String - IP address of the internal access.
- enable
Public BooleanDomain Dns - Whether to enable public domain dns. Default value is
false
. - enable
Vpc BooleanDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - instance
Id String - ID of the TCR instance.
- region
Id Double - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region
Name String - Name of region. Conflict with region_id, can not be set at the same time.
- status String
- Status of the internal access.
- subnet
Id String - ID of subnet.
- tcr
Vpc StringAttachment Id - ID of the resource.
- vpc
Id String - ID of VPC.
- access
Ip string - IP address of the internal access.
- enable
Public booleanDomain Dns - Whether to enable public domain dns. Default value is
false
. - enable
Vpc booleanDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - instance
Id string - ID of the TCR instance.
- region
Id number - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region
Name string - Name of region. Conflict with region_id, can not be set at the same time.
- status string
- Status of the internal access.
- subnet
Id string - ID of subnet.
- tcr
Vpc stringAttachment Id - ID of the resource.
- vpc
Id string - ID of VPC.
- access_
ip str - IP address of the internal access.
- enable_
public_ booldomain_ dns - Whether to enable public domain dns. Default value is
false
. - enable_
vpc_ booldomain_ dns - Whether to enable vpc domain dns. Default value is
false
. - instance_
id str - ID of the TCR instance.
- region_
id float - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region_
name str - Name of region. Conflict with region_id, can not be set at the same time.
- status str
- Status of the internal access.
- subnet_
id str - ID of subnet.
- tcr_
vpc_ strattachment_ id - ID of the resource.
- vpc_
id str - ID of VPC.
- access
Ip String - IP address of the internal access.
- enable
Public BooleanDomain Dns - Whether to enable public domain dns. Default value is
false
. - enable
Vpc BooleanDomain Dns - Whether to enable vpc domain dns. Default value is
false
. - instance
Id String - ID of the TCR instance.
- region
Id Number - this argument was deprecated, use
region_name
instead. ID of region. Conflict with region_name, can not be set at the same time. - region
Name String - Name of region. Conflict with region_id, can not be set at the same time.
- status String
- Status of the internal access.
- subnet
Id String - ID of subnet.
- tcr
Vpc StringAttachment Id - ID of the resource.
- vpc
Id String - ID of VPC.
Import
tcr vpc attachment can be imported using the id, e.g.
$ pulumi import tencentcloud:index/tcrVpcAttachment:TcrVpcAttachment foo instance_id#vpc_id#subnet_id
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.