alicloud.cloudconnect.NetworkGrant
Explore with Pulumi AI
Provides a Cloud Connect Network Grant resource. If the CEN instance to be attached belongs to another account, authorization by the CEN instance is required.
For information about Cloud Connect Network Grant and how to use it, see What is Cloud Connect Network Grant.
NOTE: Available since v1.63.0.
NOTE: Only the following regions support create Cloud Connect Network Grant. [
cn-shanghai
,cn-shanghai-finance-1
,cn-hongkong
,ap-southeast-1
,ap-southeast-3
,ap-southeast-5
,ap-northeast-1
,eu-central-1
]
Example Usage
Basic Usage
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 anotherUid = config.getNumber("anotherUid") || 123456789;
// Method 2: Use the target cen account's access_key, secret_key
// provider "alicloud" {
// region = "cn-hangzhou"
// access_key = "access_key"
// secret_key = "secret_key"
// alias = "cen_account"
// }
const _default = new alicloud.cloudconnect.Network("default", {
name: name,
description: name,
cidrBlock: "192.168.0.0/24",
isDefault: true,
});
const cen = new alicloud.cen.Instance("cen", {cenInstanceName: name});
const defaultNetworkGrant = new alicloud.cloudconnect.NetworkGrant("default", {
ccnId: _default.id,
cenId: cen.id,
cenUid: anotherUid,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
another_uid = config.get_float("anotherUid")
if another_uid is None:
another_uid = 123456789
# Method 2: Use the target cen account's access_key, secret_key
# provider "alicloud" {
# region = "cn-hangzhou"
# access_key = "access_key"
# secret_key = "secret_key"
# alias = "cen_account"
# }
default = alicloud.cloudconnect.Network("default",
name=name,
description=name,
cidr_block="192.168.0.0/24",
is_default=True)
cen = alicloud.cen.Instance("cen", cen_instance_name=name)
default_network_grant = alicloud.cloudconnect.NetworkGrant("default",
ccn_id=default.id,
cen_id=cen.id,
cen_uid=another_uid)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudconnect"
"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
}
anotherUid := float64(123456789)
if param := cfg.GetFloat64("anotherUid"); param != 0 {
anotherUid = param
}
// Method 2: Use the target cen account's access_key, secret_key
//
// provider "alicloud" {
// region = "cn-hangzhou"
// access_key = "access_key"
// secret_key = "secret_key"
// alias = "cen_account"
// }
_, err := cloudconnect.NewNetwork(ctx, "default", &cloudconnect.NetworkArgs{
Name: pulumi.String(name),
Description: pulumi.String(name),
CidrBlock: pulumi.String("192.168.0.0/24"),
IsDefault: pulumi.Bool(true),
})
if err != nil {
return err
}
cen, err := cen.NewInstance(ctx, "cen", &cen.InstanceArgs{
CenInstanceName: pulumi.String(name),
})
if err != nil {
return err
}
_, err = cloudconnect.NewNetworkGrant(ctx, "default", &cloudconnect.NetworkGrantArgs{
CcnId: _default.ID(),
CenId: cen.ID(),
CenUid: pulumi.Float64(anotherUid),
})
if err != nil {
return err
}
return nil
})
}
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 anotherUid = config.GetDouble("anotherUid") ?? 123456789;
// Method 2: Use the target cen account's access_key, secret_key
// provider "alicloud" {
// region = "cn-hangzhou"
// access_key = "access_key"
// secret_key = "secret_key"
// alias = "cen_account"
// }
var @default = new AliCloud.CloudConnect.Network("default", new()
{
Name = name,
Description = name,
CidrBlock = "192.168.0.0/24",
IsDefault = true,
});
var cen = new AliCloud.Cen.Instance("cen", new()
{
CenInstanceName = name,
});
var defaultNetworkGrant = new AliCloud.CloudConnect.NetworkGrant("default", new()
{
CcnId = @default.Id,
CenId = cen.Id,
CenUid = anotherUid,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cloudconnect.Network;
import com.pulumi.alicloud.cloudconnect.NetworkArgs;
import com.pulumi.alicloud.cen.Instance;
import com.pulumi.alicloud.cen.InstanceArgs;
import com.pulumi.alicloud.cloudconnect.NetworkGrant;
import com.pulumi.alicloud.cloudconnect.NetworkGrantArgs;
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 anotherUid = config.get("anotherUid").orElse(123456789);
// Method 2: Use the target cen account's access_key, secret_key
// provider "alicloud" {
// region = "cn-hangzhou"
// access_key = "access_key"
// secret_key = "secret_key"
// alias = "cen_account"
// }
var default_ = new Network("default", NetworkArgs.builder()
.name(name)
.description(name)
.cidrBlock("192.168.0.0/24")
.isDefault(true)
.build());
var cen = new Instance("cen", InstanceArgs.builder()
.cenInstanceName(name)
.build());
var defaultNetworkGrant = new NetworkGrant("defaultNetworkGrant", NetworkGrantArgs.builder()
.ccnId(default_.id())
.cenId(cen.id())
.cenUid(anotherUid)
.build());
}
}
configuration:
name:
type: string
default: tf-example
anotherUid:
type: number
default: 1.23456789e+08
resources:
# Method 2: Use the target cen account's access_key, secret_key
# provider "alicloud" {
# region = "cn-hangzhou"
# access_key = "access_key"
# secret_key = "secret_key"
# alias = "cen_account"
# }
default:
type: alicloud:cloudconnect:Network
properties:
name: ${name}
description: ${name}
cidrBlock: 192.168.0.0/24
isDefault: true
cen:
type: alicloud:cen:Instance
properties:
cenInstanceName: ${name}
defaultNetworkGrant:
type: alicloud:cloudconnect:NetworkGrant
name: default
properties:
ccnId: ${default.id}
cenId: ${cen.id}
cenUid: ${anotherUid}
Create NetworkGrant Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkGrant(name: string, args: NetworkGrantArgs, opts?: CustomResourceOptions);
@overload
def NetworkGrant(resource_name: str,
args: NetworkGrantArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkGrant(resource_name: str,
opts: Optional[ResourceOptions] = None,
ccn_id: Optional[str] = None,
cen_id: Optional[str] = None,
cen_uid: Optional[str] = None)
func NewNetworkGrant(ctx *Context, name string, args NetworkGrantArgs, opts ...ResourceOption) (*NetworkGrant, error)
public NetworkGrant(string name, NetworkGrantArgs args, CustomResourceOptions? opts = null)
public NetworkGrant(String name, NetworkGrantArgs args)
public NetworkGrant(String name, NetworkGrantArgs args, CustomResourceOptions options)
type: alicloud:cloudconnect:NetworkGrant
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 NetworkGrantArgs
- 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 NetworkGrantArgs
- 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 NetworkGrantArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkGrantArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkGrantArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var networkGrantResource = new AliCloud.CloudConnect.NetworkGrant("networkGrantResource", new()
{
CcnId = "string",
CenId = "string",
CenUid = "string",
});
example, err := cloudconnect.NewNetworkGrant(ctx, "networkGrantResource", &cloudconnect.NetworkGrantArgs{
CcnId: pulumi.String("string"),
CenId: pulumi.String("string"),
CenUid: pulumi.String("string"),
})
var networkGrantResource = new NetworkGrant("networkGrantResource", NetworkGrantArgs.builder()
.ccnId("string")
.cenId("string")
.cenUid("string")
.build());
network_grant_resource = alicloud.cloudconnect.NetworkGrant("networkGrantResource",
ccn_id="string",
cen_id="string",
cen_uid="string")
const networkGrantResource = new alicloud.cloudconnect.NetworkGrant("networkGrantResource", {
ccnId: "string",
cenId: "string",
cenUid: "string",
});
type: alicloud:cloudconnect:NetworkGrant
properties:
ccnId: string
cenId: string
cenUid: string
NetworkGrant 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 NetworkGrant resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkGrant 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 NetworkGrant Resource
Get an existing NetworkGrant 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?: NetworkGrantState, opts?: CustomResourceOptions): NetworkGrant
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
ccn_id: Optional[str] = None,
cen_id: Optional[str] = None,
cen_uid: Optional[str] = None) -> NetworkGrant
func GetNetworkGrant(ctx *Context, name string, id IDInput, state *NetworkGrantState, opts ...ResourceOption) (*NetworkGrant, error)
public static NetworkGrant Get(string name, Input<string> id, NetworkGrantState? state, CustomResourceOptions? opts = null)
public static NetworkGrant get(String name, Output<String> id, NetworkGrantState 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.
Import
The Cloud Connect Network Grant can be imported using the instance_id, e.g.
$ pulumi import alicloud:cloudconnect/networkGrant:NetworkGrant example ccn-abc123456:cen-abc123456
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.