alicloud.cloudconnect.NetworkAttachment
Explore with Pulumi AI
Provides a Cloud Connect Network Attachment resource. This topic describes how to associate a Smart Access Gateway (SAG) instance with a network instance. You must associate an SAG instance with a network instance if you want to connect the SAG to Alibaba Cloud. You can connect an SAG to Alibaba Cloud through a leased line, the Internet, or the active and standby links.
For information about Cloud Connect Network Attachment and how to use it, see What is Cloud Connect Network Attachment.
NOTE: Available since v1.64.0.
NOTE: Only the following regions support. [
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 sagId = config.get("sagId") || "sag-9bifkf***";
const _default = new alicloud.cloudconnect.Network("default", {
name: name,
description: name,
cidrBlock: "192.168.0.0/24",
isDefault: true,
});
const defaultNetworkAttachment = new alicloud.cloudconnect.NetworkAttachment("default", {
ccnId: _default.id,
sagId: sagId,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
sag_id = config.get("sagId")
if sag_id is None:
sag_id = "sag-9bifkf***"
default = alicloud.cloudconnect.Network("default",
name=name,
description=name,
cidr_block="192.168.0.0/24",
is_default=True)
default_network_attachment = alicloud.cloudconnect.NetworkAttachment("default",
ccn_id=default.id,
sag_id=sag_id)
package main
import (
"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
}
sagId := "sag-9bifkf***"
if param := cfg.Get("sagId"); param != "" {
sagId = param
}
_, 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
}
_, err = cloudconnect.NewNetworkAttachment(ctx, "default", &cloudconnect.NetworkAttachmentArgs{
CcnId: _default.ID(),
SagId: pulumi.String(sagId),
})
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 sagId = config.Get("sagId") ?? "sag-9bifkf***";
var @default = new AliCloud.CloudConnect.Network("default", new()
{
Name = name,
Description = name,
CidrBlock = "192.168.0.0/24",
IsDefault = true,
});
var defaultNetworkAttachment = new AliCloud.CloudConnect.NetworkAttachment("default", new()
{
CcnId = @default.Id,
SagId = sagId,
});
});
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.cloudconnect.NetworkAttachment;
import com.pulumi.alicloud.cloudconnect.NetworkAttachmentArgs;
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 sagId = config.get("sagId").orElse("sag-9bifkf***");
var default_ = new Network("default", NetworkArgs.builder()
.name(name)
.description(name)
.cidrBlock("192.168.0.0/24")
.isDefault(true)
.build());
var defaultNetworkAttachment = new NetworkAttachment("defaultNetworkAttachment", NetworkAttachmentArgs.builder()
.ccnId(default_.id())
.sagId(sagId)
.build());
}
}
configuration:
name:
type: string
default: tf-example
sagId:
type: string
default: sag-9bifkf***
resources:
default:
type: alicloud:cloudconnect:Network
properties:
name: ${name}
description: ${name}
cidrBlock: 192.168.0.0/24
isDefault: true
defaultNetworkAttachment:
type: alicloud:cloudconnect:NetworkAttachment
name: default
properties:
ccnId: ${default.id}
sagId: ${sagId}
Create NetworkAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkAttachment(name: string, args: NetworkAttachmentArgs, opts?: CustomResourceOptions);
@overload
def NetworkAttachment(resource_name: str,
args: NetworkAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
ccn_id: Optional[str] = None,
sag_id: Optional[str] = None)
func NewNetworkAttachment(ctx *Context, name string, args NetworkAttachmentArgs, opts ...ResourceOption) (*NetworkAttachment, error)
public NetworkAttachment(string name, NetworkAttachmentArgs args, CustomResourceOptions? opts = null)
public NetworkAttachment(String name, NetworkAttachmentArgs args)
public NetworkAttachment(String name, NetworkAttachmentArgs args, CustomResourceOptions options)
type: alicloud:cloudconnect:NetworkAttachment
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 NetworkAttachmentArgs
- 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 NetworkAttachmentArgs
- 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 NetworkAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkAttachmentArgs
- 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 networkAttachmentResource = new AliCloud.CloudConnect.NetworkAttachment("networkAttachmentResource", new()
{
CcnId = "string",
SagId = "string",
});
example, err := cloudconnect.NewNetworkAttachment(ctx, "networkAttachmentResource", &cloudconnect.NetworkAttachmentArgs{
CcnId: pulumi.String("string"),
SagId: pulumi.String("string"),
})
var networkAttachmentResource = new NetworkAttachment("networkAttachmentResource", NetworkAttachmentArgs.builder()
.ccnId("string")
.sagId("string")
.build());
network_attachment_resource = alicloud.cloudconnect.NetworkAttachment("networkAttachmentResource",
ccn_id="string",
sag_id="string")
const networkAttachmentResource = new alicloud.cloudconnect.NetworkAttachment("networkAttachmentResource", {
ccnId: "string",
sagId: "string",
});
type: alicloud:cloudconnect:NetworkAttachment
properties:
ccnId: string
sagId: string
NetworkAttachment 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 NetworkAttachment resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkAttachment 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 NetworkAttachment Resource
Get an existing NetworkAttachment 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?: NetworkAttachmentState, opts?: CustomResourceOptions): NetworkAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
ccn_id: Optional[str] = None,
sag_id: Optional[str] = None) -> NetworkAttachment
func GetNetworkAttachment(ctx *Context, name string, id IDInput, state *NetworkAttachmentState, opts ...ResourceOption) (*NetworkAttachment, error)
public static NetworkAttachment Get(string name, Input<string> id, NetworkAttachmentState? state, CustomResourceOptions? opts = null)
public static NetworkAttachment get(String name, Output<String> id, NetworkAttachmentState 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 Attachment can be imported using the instance_id, e.g.
$ pulumi import alicloud:cloudconnect/networkAttachment:NetworkAttachment example ccn-abc123456:sag-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.