1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. expressconnect
  5. GrantRuleToCen
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.expressconnect.GrantRuleToCen

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a Express Connect Grant Rule To Cen resource.

    For information about Express Connect Grant Rule To Cen and how to use it, see What is Grant Rule To Cen.

    NOTE: Available since v1.196.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const example = alicloud.expressconnect.getPhysicalConnections({
        nameRegex: "^preserved-NODELETING",
    });
    const vlanId = new random.index.Integer("vlan_id", {
        max: 2999,
        min: 1,
    });
    const exampleVirtualBorderRouter = new alicloud.expressconnect.VirtualBorderRouter("example", {
        localGatewayIp: "10.0.0.1",
        peerGatewayIp: "10.0.0.2",
        peeringSubnetMask: "255.255.255.252",
        physicalConnectionId: example.then(example => example.connections?.[0]?.id),
        virtualBorderRouterName: name,
        vlanId: vlanId.id,
        minRxInterval: 1000,
        minTxInterval: 1000,
        detectMultiplier: 10,
    });
    const exampleInstance = new alicloud.cen.Instance("example", {cenInstanceName: name});
    const default = alicloud.getAccount({});
    const exampleGrantRuleToCen = new alicloud.expressconnect.GrantRuleToCen("example", {
        cenId: exampleInstance.id,
        cenOwnerId: _default.then(_default => _default.id),
        instanceId: exampleVirtualBorderRouter.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    example = alicloud.expressconnect.get_physical_connections(name_regex="^preserved-NODELETING")
    vlan_id = random.index.Integer("vlan_id",
        max=2999,
        min=1)
    example_virtual_border_router = alicloud.expressconnect.VirtualBorderRouter("example",
        local_gateway_ip="10.0.0.1",
        peer_gateway_ip="10.0.0.2",
        peering_subnet_mask="255.255.255.252",
        physical_connection_id=example.connections[0].id,
        virtual_border_router_name=name,
        vlan_id=vlan_id["id"],
        min_rx_interval=1000,
        min_tx_interval=1000,
        detect_multiplier=10)
    example_instance = alicloud.cen.Instance("example", cen_instance_name=name)
    default = alicloud.get_account()
    example_grant_rule_to_cen = alicloud.expressconnect.GrantRuleToCen("example",
        cen_id=example_instance.id,
        cen_owner_id=default.id,
        instance_id=example_virtual_border_router.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/expressconnect"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"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
    		}
    		example, err := expressconnect.GetPhysicalConnections(ctx, &expressconnect.GetPhysicalConnectionsArgs{
    			NameRegex: pulumi.StringRef("^preserved-NODELETING"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		vlanId, err := random.NewInteger(ctx, "vlan_id", &random.IntegerArgs{
    			Max: 2999,
    			Min: 1,
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualBorderRouter, err := expressconnect.NewVirtualBorderRouter(ctx, "example", &expressconnect.VirtualBorderRouterArgs{
    			LocalGatewayIp:          pulumi.String("10.0.0.1"),
    			PeerGatewayIp:           pulumi.String("10.0.0.2"),
    			PeeringSubnetMask:       pulumi.String("255.255.255.252"),
    			PhysicalConnectionId:    pulumi.String(example.Connections[0].Id),
    			VirtualBorderRouterName: pulumi.String(name),
    			VlanId:                  vlanId.Id,
    			MinRxInterval:           pulumi.Int(1000),
    			MinTxInterval:           pulumi.Int(1000),
    			DetectMultiplier:        pulumi.Int(10),
    		})
    		if err != nil {
    			return err
    		}
    		exampleInstance, err := cen.NewInstance(ctx, "example", &cen.InstanceArgs{
    			CenInstanceName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_default, err := alicloud.GetAccount(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = expressconnect.NewGrantRuleToCen(ctx, "example", &expressconnect.GrantRuleToCenArgs{
    			CenId:      exampleInstance.ID(),
    			CenOwnerId: pulumi.String(_default.Id),
    			InstanceId: exampleVirtualBorderRouter.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var example = AliCloud.ExpressConnect.GetPhysicalConnections.Invoke(new()
        {
            NameRegex = "^preserved-NODELETING",
        });
    
        var vlanId = new Random.Index.Integer("vlan_id", new()
        {
            Max = 2999,
            Min = 1,
        });
    
        var exampleVirtualBorderRouter = new AliCloud.ExpressConnect.VirtualBorderRouter("example", new()
        {
            LocalGatewayIp = "10.0.0.1",
            PeerGatewayIp = "10.0.0.2",
            PeeringSubnetMask = "255.255.255.252",
            PhysicalConnectionId = example.Apply(getPhysicalConnectionsResult => getPhysicalConnectionsResult.Connections[0]?.Id),
            VirtualBorderRouterName = name,
            VlanId = vlanId.Id,
            MinRxInterval = 1000,
            MinTxInterval = 1000,
            DetectMultiplier = 10,
        });
    
        var exampleInstance = new AliCloud.Cen.Instance("example", new()
        {
            CenInstanceName = name,
        });
    
        var @default = AliCloud.GetAccount.Invoke();
    
        var exampleGrantRuleToCen = new AliCloud.ExpressConnect.GrantRuleToCen("example", new()
        {
            CenId = exampleInstance.Id,
            CenOwnerId = @default.Apply(@default => @default.Apply(getAccountResult => getAccountResult.Id)),
            InstanceId = exampleVirtualBorderRouter.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.expressconnect.ExpressconnectFunctions;
    import com.pulumi.alicloud.expressconnect.inputs.GetPhysicalConnectionsArgs;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.expressconnect.VirtualBorderRouter;
    import com.pulumi.alicloud.expressconnect.VirtualBorderRouterArgs;
    import com.pulumi.alicloud.cen.Instance;
    import com.pulumi.alicloud.cen.InstanceArgs;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.expressconnect.GrantRuleToCen;
    import com.pulumi.alicloud.expressconnect.GrantRuleToCenArgs;
    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 example = ExpressconnectFunctions.getPhysicalConnections(GetPhysicalConnectionsArgs.builder()
                .nameRegex("^preserved-NODELETING")
                .build());
    
            var vlanId = new Integer("vlanId", IntegerArgs.builder()
                .max(2999)
                .min(1)
                .build());
    
            var exampleVirtualBorderRouter = new VirtualBorderRouter("exampleVirtualBorderRouter", VirtualBorderRouterArgs.builder()
                .localGatewayIp("10.0.0.1")
                .peerGatewayIp("10.0.0.2")
                .peeringSubnetMask("255.255.255.252")
                .physicalConnectionId(example.applyValue(getPhysicalConnectionsResult -> getPhysicalConnectionsResult.connections()[0].id()))
                .virtualBorderRouterName(name)
                .vlanId(vlanId.id())
                .minRxInterval(1000)
                .minTxInterval(1000)
                .detectMultiplier(10)
                .build());
    
            var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
                .cenInstanceName(name)
                .build());
    
            final var default = AlicloudFunctions.getAccount();
    
            var exampleGrantRuleToCen = new GrantRuleToCen("exampleGrantRuleToCen", GrantRuleToCenArgs.builder()
                .cenId(exampleInstance.id())
                .cenOwnerId(default_.id())
                .instanceId(exampleVirtualBorderRouter.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      vlanId:
        type: random:integer
        name: vlan_id
        properties:
          max: 2999
          min: 1
      exampleVirtualBorderRouter:
        type: alicloud:expressconnect:VirtualBorderRouter
        name: example
        properties:
          localGatewayIp: 10.0.0.1
          peerGatewayIp: 10.0.0.2
          peeringSubnetMask: 255.255.255.252
          physicalConnectionId: ${example.connections[0].id}
          virtualBorderRouterName: ${name}
          vlanId: ${vlanId.id}
          minRxInterval: 1000
          minTxInterval: 1000
          detectMultiplier: 10
      exampleInstance:
        type: alicloud:cen:Instance
        name: example
        properties:
          cenInstanceName: ${name}
      exampleGrantRuleToCen:
        type: alicloud:expressconnect:GrantRuleToCen
        name: example
        properties:
          cenId: ${exampleInstance.id}
          cenOwnerId: ${default.id}
          instanceId: ${exampleVirtualBorderRouter.id}
    variables:
      example:
        fn::invoke:
          Function: alicloud:expressconnect:getPhysicalConnections
          Arguments:
            nameRegex: ^preserved-NODELETING
      default:
        fn::invoke:
          Function: alicloud:getAccount
          Arguments: {}
    

    Create GrantRuleToCen Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new GrantRuleToCen(name: string, args: GrantRuleToCenArgs, opts?: CustomResourceOptions);
    @overload
    def GrantRuleToCen(resource_name: str,
                       args: GrantRuleToCenArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def GrantRuleToCen(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       cen_id: Optional[str] = None,
                       cen_owner_id: Optional[int] = None,
                       instance_id: Optional[str] = None)
    func NewGrantRuleToCen(ctx *Context, name string, args GrantRuleToCenArgs, opts ...ResourceOption) (*GrantRuleToCen, error)
    public GrantRuleToCen(string name, GrantRuleToCenArgs args, CustomResourceOptions? opts = null)
    public GrantRuleToCen(String name, GrantRuleToCenArgs args)
    public GrantRuleToCen(String name, GrantRuleToCenArgs args, CustomResourceOptions options)
    
    type: alicloud:expressconnect:GrantRuleToCen
    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 GrantRuleToCenArgs
    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 GrantRuleToCenArgs
    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 GrantRuleToCenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GrantRuleToCenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GrantRuleToCenArgs
    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 grantRuleToCenResource = new AliCloud.ExpressConnect.GrantRuleToCen("grantRuleToCenResource", new()
    {
        CenId = "string",
        CenOwnerId = 0,
        InstanceId = "string",
    });
    
    example, err := expressconnect.NewGrantRuleToCen(ctx, "grantRuleToCenResource", &expressconnect.GrantRuleToCenArgs{
    	CenId:      pulumi.String("string"),
    	CenOwnerId: pulumi.Int(0),
    	InstanceId: pulumi.String("string"),
    })
    
    var grantRuleToCenResource = new GrantRuleToCen("grantRuleToCenResource", GrantRuleToCenArgs.builder()
        .cenId("string")
        .cenOwnerId(0)
        .instanceId("string")
        .build());
    
    grant_rule_to_cen_resource = alicloud.expressconnect.GrantRuleToCen("grantRuleToCenResource",
        cen_id="string",
        cen_owner_id=0,
        instance_id="string")
    
    const grantRuleToCenResource = new alicloud.expressconnect.GrantRuleToCen("grantRuleToCenResource", {
        cenId: "string",
        cenOwnerId: 0,
        instanceId: "string",
    });
    
    type: alicloud:expressconnect:GrantRuleToCen
    properties:
        cenId: string
        cenOwnerId: 0
        instanceId: string
    

    GrantRuleToCen 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 GrantRuleToCen resource accepts the following input properties:

    CenId string
    The ID of the CEN instance to which you want to grant permissions.
    CenOwnerId int
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    InstanceId string
    The ID of the VBR.
    CenId string
    The ID of the CEN instance to which you want to grant permissions.
    CenOwnerId int
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    InstanceId string
    The ID of the VBR.
    cenId String
    The ID of the CEN instance to which you want to grant permissions.
    cenOwnerId Integer
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instanceId String
    The ID of the VBR.
    cenId string
    The ID of the CEN instance to which you want to grant permissions.
    cenOwnerId number
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instanceId string
    The ID of the VBR.
    cen_id str
    The ID of the CEN instance to which you want to grant permissions.
    cen_owner_id int
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instance_id str
    The ID of the VBR.
    cenId String
    The ID of the CEN instance to which you want to grant permissions.
    cenOwnerId Number
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instanceId String
    The ID of the VBR.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the GrantRuleToCen 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 GrantRuleToCen Resource

    Get an existing GrantRuleToCen 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?: GrantRuleToCenState, opts?: CustomResourceOptions): GrantRuleToCen
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cen_id: Optional[str] = None,
            cen_owner_id: Optional[int] = None,
            instance_id: Optional[str] = None) -> GrantRuleToCen
    func GetGrantRuleToCen(ctx *Context, name string, id IDInput, state *GrantRuleToCenState, opts ...ResourceOption) (*GrantRuleToCen, error)
    public static GrantRuleToCen Get(string name, Input<string> id, GrantRuleToCenState? state, CustomResourceOptions? opts = null)
    public static GrantRuleToCen get(String name, Output<String> id, GrantRuleToCenState 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.
    The following state arguments are supported:
    CenId string
    The ID of the CEN instance to which you want to grant permissions.
    CenOwnerId int
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    InstanceId string
    The ID of the VBR.
    CenId string
    The ID of the CEN instance to which you want to grant permissions.
    CenOwnerId int
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    InstanceId string
    The ID of the VBR.
    cenId String
    The ID of the CEN instance to which you want to grant permissions.
    cenOwnerId Integer
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instanceId String
    The ID of the VBR.
    cenId string
    The ID of the CEN instance to which you want to grant permissions.
    cenOwnerId number
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instanceId string
    The ID of the VBR.
    cen_id str
    The ID of the CEN instance to which you want to grant permissions.
    cen_owner_id int
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instance_id str
    The ID of the VBR.
    cenId String
    The ID of the CEN instance to which you want to grant permissions.
    cenOwnerId Number
    The user ID (UID) of the Alibaba Cloud account to which the CEN instance belongs.
    instanceId String
    The ID of the VBR.

    Import

    Express Connect Grant Rule To Cen can be imported using the id, e.g.

    $ pulumi import alicloud:expressconnect/grantRuleToCen:GrantRuleToCen example <cen_id>:<cen_owner_id>:<instance_id>
    

    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.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi