InstanceGrant

Provides a CEN child instance grant resource, which allow you to authorize a VPC or VBR to a CEN of a different account.

For more information about how to use it, see Attach a network in a different account.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new instance-grant and use it to grant one child instance of account1 to a new CEN of account 2.
        var account1 = new AliCloud.Provider("account1", new AliCloud.ProviderArgs
        {
            AccessKey = "access123",
            SecretKey = "secret123",
        });
        var account2 = new AliCloud.Provider("account2", new AliCloud.ProviderArgs
        {
            AccessKey = "access456",
            SecretKey = "secret456",
        });
        var config = new Config();
        var name = config.Get("name") ?? "tf-testAccCenInstanceGrantBasic";
        var cen = new AliCloud.Cen.Instance("cen", new AliCloud.Cen.InstanceArgs
        {
        });
        var vpc = new AliCloud.Vpc.Network("vpc", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "192.168.0.0/16",
        });
        var fooInstanceGrant = new AliCloud.Cen.InstanceGrant("fooInstanceGrant", new AliCloud.Cen.InstanceGrantArgs
        {
            CenId = cen.Id,
            CenOwnerId = "uid2",
            ChildInstanceId = vpc.Id,
        });
        var fooInstanceAttachment = new AliCloud.Cen.InstanceAttachment("fooInstanceAttachment", new AliCloud.Cen.InstanceAttachmentArgs
        {
            ChildInstanceId = vpc.Id,
            ChildInstanceOwnerId = "uid1",
            ChildInstanceRegionId = "cn-qingdao",
            InstanceId = cen.Id,
        });
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud
import pulumi_pulumi as pulumi

# Create a new instance-grant and use it to grant one child instance of account1 to a new CEN of account 2.
account1 = pulumi.providers.Alicloud("account1",
    access_key="access123",
    secret_key="secret123")
account2 = pulumi.providers.Alicloud("account2",
    access_key="access456",
    secret_key="secret456")
config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "tf-testAccCenInstanceGrantBasic"
cen = alicloud.cen.Instance("cen")
vpc = alicloud.vpc.Network("vpc", cidr_block="192.168.0.0/16")
foo_instance_grant = alicloud.cen.InstanceGrant("fooInstanceGrant",
    cen_id=cen.id,
    cen_owner_id="uid2",
    child_instance_id=vpc.id)
foo_instance_attachment = alicloud.cen.InstanceAttachment("fooInstanceAttachment",
    child_instance_id=vpc.id,
    child_instance_owner_id="uid1",
    child_instance_region_id="cn-qingdao",
    instance_id=cen.id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "tf-testAccCenInstanceGrantBasic";

// Create a new instance-grant and use it to grant one child instance of account1 to a new CEN of account 2.
const account1 = new alicloud.Provider("account1", {
    accessKey: "access123",
    secretKey: "secret123",
});
const account2 = new alicloud.Provider("account2", {
    accessKey: "access456",
    secretKey: "secret456",
});
const cen = new alicloud.cen.Instance("cen", {}, { provider: account2 });
const vpc = new alicloud.vpc.Network("vpc", {
    cidrBlock: "192.168.0.0/16",
}, { provider: account1 });
const fooInstanceGrant = new alicloud.cen.InstanceGrant("foo", {
    cenId: cen.id,
    cenOwnerId: "uid2",
    childInstanceId: vpc.id,
}, { provider: account1 });
const fooInstanceAttachment = new alicloud.cen.InstanceAttachment("foo", {
    childInstanceId: vpc.id,
    childInstanceOwnerId: "uid1",
    childInstanceRegionId: "cn-qingdao",
    instanceId: cen.id,
}, { provider: account2, dependsOn: [fooInstanceGrant] });

Create a InstanceGrant Resource

def InstanceGrant(resource_name, opts=None, cen_id=None, cen_owner_id=None, child_instance_id=None, __props__=None);
name string
The unique name of the resource.
args InstanceGrantArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args InstanceGrantArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args InstanceGrantArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

InstanceGrant Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The InstanceGrant resource accepts the following input properties:

CenId string

The ID of the CEN.

CenOwnerId string

The owner UID of the CEN which the child instance granted to.

ChildInstanceId string

The ID of the child instance to grant.

CenId string

The ID of the CEN.

CenOwnerId string

The owner UID of the CEN which the child instance granted to.

ChildInstanceId string

The ID of the child instance to grant.

cenId string

The ID of the CEN.

cenOwnerId string

The owner UID of the CEN which the child instance granted to.

childInstanceId string

The ID of the child instance to grant.

cen_id str

The ID of the CEN.

cen_owner_id str

The owner UID of the CEN which the child instance granted to.

child_instance_id str

The ID of the child instance to grant.

Outputs

All input properties are implicitly available as output properties. Additionally, the InstanceGrant 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing InstanceGrant Resource

Get an existing InstanceGrant 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?: InstanceGrantState, opts?: CustomResourceOptions): InstanceGrant
static get(resource_name, id, opts=None, cen_id=None, cen_owner_id=None, child_instance_id=None, __props__=None);
func GetInstanceGrant(ctx *Context, name string, id IDInput, state *InstanceGrantState, opts ...ResourceOption) (*InstanceGrant, error)
public static InstanceGrant Get(string name, Input<string> id, InstanceGrantState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

CenId string

The ID of the CEN.

CenOwnerId string

The owner UID of the CEN which the child instance granted to.

ChildInstanceId string

The ID of the child instance to grant.

CenId string

The ID of the CEN.

CenOwnerId string

The owner UID of the CEN which the child instance granted to.

ChildInstanceId string

The ID of the child instance to grant.

cenId string

The ID of the CEN.

cenOwnerId string

The owner UID of the CEN which the child instance granted to.

childInstanceId string

The ID of the child instance to grant.

cen_id str

The ID of the CEN.

cen_owner_id str

The owner UID of the CEN which the child instance granted to.

child_instance_id str

The ID of the child instance to grant.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.