alicloud.vpc.NetworkAclAttachment
Explore with Pulumi AI
Provides a network acl attachment resource to associate network acls to vswitches.
DEPRECATED: This resource has been deprecated from version
1.124.0
. Replace byresources
with the resource alicloud_network_acl. Note that because this resource conflicts with theresources
attribute ofalicloud.vpc.NetworkAcl
, this resource can no be used.
NOTE: Available in 1.44.0+. Currently, the resource are only available in Hongkong(cn-hongkong), and Indonesia(ap-southeast-1) regions.
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") || "NatGatewayConfigSpec";
const default = alicloud.getZones({
availableResourceCreation: "VSwitch",
});
const defaultNetwork = new alicloud.vpc.Network("default", {
vpcName: name,
cidrBlock: "172.16.0.0/12",
});
const defaultNetworkAcl = new alicloud.vpc.NetworkAcl("default", {
vpcId: defaultNetwork.id,
networkAclName: name,
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
vpcId: defaultNetwork.id,
cidrBlock: "172.16.0.0/21",
zoneId: _default.then(_default => _default.zones?.[0]?.id),
vswitchName: name,
});
const defaultNetworkAclAttachment = new alicloud.vpc.NetworkAclAttachment("default", {
networkAclId: defaultNetworkAcl.id,
resources: [{
resourceId: defaultSwitch.id,
resourceType: "VSwitch",
}],
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "NatGatewayConfigSpec"
default = alicloud.get_zones(available_resource_creation="VSwitch")
default_network = alicloud.vpc.Network("default",
vpc_name=name,
cidr_block="172.16.0.0/12")
default_network_acl = alicloud.vpc.NetworkAcl("default",
vpc_id=default_network.id,
network_acl_name=name)
default_switch = alicloud.vpc.Switch("default",
vpc_id=default_network.id,
cidr_block="172.16.0.0/21",
zone_id=default.zones[0].id,
vswitch_name=name)
default_network_acl_attachment = alicloud.vpc.NetworkAclAttachment("default",
network_acl_id=default_network_acl.id,
resources=[{
"resource_id": default_switch.id,
"resource_type": "VSwitch",
}])
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"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 := "NatGatewayConfigSpec"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableResourceCreation: pulumi.StringRef("VSwitch"),
}, nil)
if err != nil {
return err
}
defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("172.16.0.0/12"),
})
if err != nil {
return err
}
defaultNetworkAcl, err := vpc.NewNetworkAcl(ctx, "default", &vpc.NetworkAclArgs{
VpcId: defaultNetwork.ID(),
NetworkAclName: pulumi.String(name),
})
if err != nil {
return err
}
defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
VpcId: defaultNetwork.ID(),
CidrBlock: pulumi.String("172.16.0.0/21"),
ZoneId: pulumi.String(_default.Zones[0].Id),
VswitchName: pulumi.String(name),
})
if err != nil {
return err
}
_, err = vpc.NewNetworkAclAttachment(ctx, "default", &vpc.NetworkAclAttachmentArgs{
NetworkAclId: defaultNetworkAcl.ID(),
Resources: vpc.NetworkAclAttachmentResourceArray{
&vpc.NetworkAclAttachmentResourceArgs{
ResourceId: defaultSwitch.ID(),
ResourceType: pulumi.String("VSwitch"),
},
},
})
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") ?? "NatGatewayConfigSpec";
var @default = AliCloud.GetZones.Invoke(new()
{
AvailableResourceCreation = "VSwitch",
});
var defaultNetwork = new AliCloud.Vpc.Network("default", new()
{
VpcName = name,
CidrBlock = "172.16.0.0/12",
});
var defaultNetworkAcl = new AliCloud.Vpc.NetworkAcl("default", new()
{
VpcId = defaultNetwork.Id,
NetworkAclName = name,
});
var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
{
VpcId = defaultNetwork.Id,
CidrBlock = "172.16.0.0/21",
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
VswitchName = name,
});
var defaultNetworkAclAttachment = new AliCloud.Vpc.NetworkAclAttachment("default", new()
{
NetworkAclId = defaultNetworkAcl.Id,
Resources = new[]
{
new AliCloud.Vpc.Inputs.NetworkAclAttachmentResourceArgs
{
ResourceId = defaultSwitch.Id,
ResourceType = "VSwitch",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.NetworkAcl;
import com.pulumi.alicloud.vpc.NetworkAclArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.vpc.NetworkAclAttachment;
import com.pulumi.alicloud.vpc.NetworkAclAttachmentArgs;
import com.pulumi.alicloud.vpc.inputs.NetworkAclAttachmentResourceArgs;
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("NatGatewayConfigSpec");
final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("172.16.0.0/12")
.build());
var defaultNetworkAcl = new NetworkAcl("defaultNetworkAcl", NetworkAclArgs.builder()
.vpcId(defaultNetwork.id())
.networkAclName(name)
.build());
var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
.vpcId(defaultNetwork.id())
.cidrBlock("172.16.0.0/21")
.zoneId(default_.zones()[0].id())
.vswitchName(name)
.build());
var defaultNetworkAclAttachment = new NetworkAclAttachment("defaultNetworkAclAttachment", NetworkAclAttachmentArgs.builder()
.networkAclId(defaultNetworkAcl.id())
.resources(NetworkAclAttachmentResourceArgs.builder()
.resourceId(defaultSwitch.id())
.resourceType("VSwitch")
.build())
.build());
}
}
configuration:
name:
type: string
default: NatGatewayConfigSpec
resources:
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: ${name}
cidrBlock: 172.16.0.0/12
defaultNetworkAcl:
type: alicloud:vpc:NetworkAcl
name: default
properties:
vpcId: ${defaultNetwork.id}
networkAclName: ${name}
defaultSwitch:
type: alicloud:vpc:Switch
name: default
properties:
vpcId: ${defaultNetwork.id}
cidrBlock: 172.16.0.0/21
zoneId: ${default.zones[0].id}
vswitchName: ${name}
defaultNetworkAclAttachment:
type: alicloud:vpc:NetworkAclAttachment
name: default
properties:
networkAclId: ${defaultNetworkAcl.id}
resources:
- resourceId: ${defaultSwitch.id}
resourceType: VSwitch
variables:
default:
fn::invoke:
Function: alicloud:getZones
Arguments:
availableResourceCreation: VSwitch
Create NetworkAclAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkAclAttachment(name: string, args: NetworkAclAttachmentArgs, opts?: CustomResourceOptions);
@overload
def NetworkAclAttachment(resource_name: str,
args: NetworkAclAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkAclAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
network_acl_id: Optional[str] = None,
resources: Optional[Sequence[NetworkAclAttachmentResourceArgs]] = None)
func NewNetworkAclAttachment(ctx *Context, name string, args NetworkAclAttachmentArgs, opts ...ResourceOption) (*NetworkAclAttachment, error)
public NetworkAclAttachment(string name, NetworkAclAttachmentArgs args, CustomResourceOptions? opts = null)
public NetworkAclAttachment(String name, NetworkAclAttachmentArgs args)
public NetworkAclAttachment(String name, NetworkAclAttachmentArgs args, CustomResourceOptions options)
type: alicloud:vpc:NetworkAclAttachment
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 NetworkAclAttachmentArgs
- 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 NetworkAclAttachmentArgs
- 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 NetworkAclAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkAclAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkAclAttachmentArgs
- 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 networkAclAttachmentResource = new AliCloud.Vpc.NetworkAclAttachment("networkAclAttachmentResource", new()
{
NetworkAclId = "string",
Resources = new[]
{
new AliCloud.Vpc.Inputs.NetworkAclAttachmentResourceArgs
{
ResourceId = "string",
ResourceType = "string",
},
},
});
example, err := vpc.NewNetworkAclAttachment(ctx, "networkAclAttachmentResource", &vpc.NetworkAclAttachmentArgs{
NetworkAclId: pulumi.String("string"),
Resources: vpc.NetworkAclAttachmentResourceArray{
&vpc.NetworkAclAttachmentResourceArgs{
ResourceId: pulumi.String("string"),
ResourceType: pulumi.String("string"),
},
},
})
var networkAclAttachmentResource = new NetworkAclAttachment("networkAclAttachmentResource", NetworkAclAttachmentArgs.builder()
.networkAclId("string")
.resources(NetworkAclAttachmentResourceArgs.builder()
.resourceId("string")
.resourceType("string")
.build())
.build());
network_acl_attachment_resource = alicloud.vpc.NetworkAclAttachment("networkAclAttachmentResource",
network_acl_id="string",
resources=[{
"resource_id": "string",
"resource_type": "string",
}])
const networkAclAttachmentResource = new alicloud.vpc.NetworkAclAttachment("networkAclAttachmentResource", {
networkAclId: "string",
resources: [{
resourceId: "string",
resourceType: "string",
}],
});
type: alicloud:vpc:NetworkAclAttachment
properties:
networkAclId: string
resources:
- resourceId: string
resourceType: string
NetworkAclAttachment 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 NetworkAclAttachment resource accepts the following input properties:
- Network
Acl stringId - The id of the network acl, the field can't be changed.
- Resources
List<Pulumi.
Ali Cloud. Vpc. Inputs. Network Acl Attachment Resource> - List of the resources associated with the network acl. The details see Block Resources.
- Network
Acl stringId - The id of the network acl, the field can't be changed.
- Resources
[]Network
Acl Attachment Resource Args - List of the resources associated with the network acl. The details see Block Resources.
- network
Acl StringId - The id of the network acl, the field can't be changed.
- resources
List<Network
Acl Attachment Resource> - List of the resources associated with the network acl. The details see Block Resources.
- network
Acl stringId - The id of the network acl, the field can't be changed.
- resources
Network
Acl Attachment Resource[] - List of the resources associated with the network acl. The details see Block Resources.
- network_
acl_ strid - The id of the network acl, the field can't be changed.
- resources
Sequence[Network
Acl Attachment Resource Args] - List of the resources associated with the network acl. The details see Block Resources.
- network
Acl StringId - The id of the network acl, the field can't be changed.
- resources List<Property Map>
- List of the resources associated with the network acl. The details see Block Resources.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkAclAttachment 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 NetworkAclAttachment Resource
Get an existing NetworkAclAttachment 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?: NetworkAclAttachmentState, opts?: CustomResourceOptions): NetworkAclAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
network_acl_id: Optional[str] = None,
resources: Optional[Sequence[NetworkAclAttachmentResourceArgs]] = None) -> NetworkAclAttachment
func GetNetworkAclAttachment(ctx *Context, name string, id IDInput, state *NetworkAclAttachmentState, opts ...ResourceOption) (*NetworkAclAttachment, error)
public static NetworkAclAttachment Get(string name, Input<string> id, NetworkAclAttachmentState? state, CustomResourceOptions? opts = null)
public static NetworkAclAttachment get(String name, Output<String> id, NetworkAclAttachmentState 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.
- Network
Acl stringId - The id of the network acl, the field can't be changed.
- Resources
List<Pulumi.
Ali Cloud. Vpc. Inputs. Network Acl Attachment Resource> - List of the resources associated with the network acl. The details see Block Resources.
- Network
Acl stringId - The id of the network acl, the field can't be changed.
- Resources
[]Network
Acl Attachment Resource Args - List of the resources associated with the network acl. The details see Block Resources.
- network
Acl StringId - The id of the network acl, the field can't be changed.
- resources
List<Network
Acl Attachment Resource> - List of the resources associated with the network acl. The details see Block Resources.
- network
Acl stringId - The id of the network acl, the field can't be changed.
- resources
Network
Acl Attachment Resource[] - List of the resources associated with the network acl. The details see Block Resources.
- network_
acl_ strid - The id of the network acl, the field can't be changed.
- resources
Sequence[Network
Acl Attachment Resource Args] - List of the resources associated with the network acl. The details see Block Resources.
- network
Acl StringId - The id of the network acl, the field can't be changed.
- resources List<Property Map>
- List of the resources associated with the network acl. The details see Block Resources.
Supporting Types
NetworkAclAttachmentResource, NetworkAclAttachmentResourceArgs
- Resource
Id string - The resource id that the network acl will associate with.
- Resource
Type string - The resource id that the network acl will associate with. Only support
VSwitch
now.
- Resource
Id string - The resource id that the network acl will associate with.
- Resource
Type string - The resource id that the network acl will associate with. Only support
VSwitch
now.
- resource
Id String - The resource id that the network acl will associate with.
- resource
Type String - The resource id that the network acl will associate with. Only support
VSwitch
now.
- resource
Id string - The resource id that the network acl will associate with.
- resource
Type string - The resource id that the network acl will associate with. Only support
VSwitch
now.
- resource_
id str - The resource id that the network acl will associate with.
- resource_
type str - The resource id that the network acl will associate with. Only support
VSwitch
now.
- resource
Id String - The resource id that the network acl will associate with.
- resource
Type String - The resource id that the network acl will associate with. Only support
VSwitch
now.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.