NetworkAcl

class NetworkAcl : KotlinCustomResource

Provides a VPC Network Acl resource.

NOTE: Currently, the resource are only available in Hongkong(cn-hongkong), India(ap-south-1), and Indonesia(ap-southeast-1) regions. For information about VPC Network Acl and how to use it, see What is Network Acl. NOTE: Available since v1.43.0.

Example Usage

Basic Usage

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.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
import com.pulumi.alicloud.vpc.NetworkAcl;
import com.pulumi.alicloud.vpc.NetworkAclArgs;
import com.pulumi.alicloud.vpc.inputs.NetworkAclIngressAclEntryArgs;
import com.pulumi.alicloud.vpc.inputs.NetworkAclEgressAclEntryArgs;
import com.pulumi.alicloud.vpc.inputs.NetworkAclResourceArgs;
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 default = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.vpcName(name)
.cidrBlock("10.4.0.0/16")
.build());
var exampleSwitch = new Switch("exampleSwitch", SwitchArgs.builder()
.vswitchName(name)
.cidrBlock("10.4.0.0/24")
.vpcId(exampleNetwork.id())
.zoneId(default_.zones()[0].id())
.build());
var exampleNetworkAcl = new NetworkAcl("exampleNetworkAcl", NetworkAclArgs.builder()
.vpcId(exampleNetwork.id())
.networkAclName(name)
.description(name)
.ingressAclEntries(NetworkAclIngressAclEntryArgs.builder()
.description(String.format("%s-ingress", name))
.networkAclEntryName(String.format("%s-ingress", name))
.sourceCidrIp("196.168.2.0/21")
.policy("accept")
.port("22/80")
.protocol("tcp")
.build())
.egressAclEntries(NetworkAclEgressAclEntryArgs.builder()
.description(String.format("%s-egress", name))
.networkAclEntryName(String.format("%s-egress", name))
.destinationCidrIp("0.0.0.0/0")
.policy("accept")
.port("-1/-1")
.protocol("all")
.build())
.resources(NetworkAclResourceArgs.builder()
.resourceId(exampleSwitch.id())
.resourceType("VSwitch")
.build())
.build());
}
}

Import

VPC Network Acl can be imported using the id, e.g.

$ pulumi import alicloud:vpc/networkAcl:NetworkAcl example <id>

Properties

Link copied to clipboard
val createTime: Output<String>

The creation time of the resource.

Link copied to clipboard
val description: Output<String>?

The description of the network ACL.The description must be 1 to 256 characters in length and cannot start with http:// or https.

Link copied to clipboard

Out direction rule information. See egress_acl_entries below.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Inward direction rule information. See ingress_acl_entries below.

Link copied to clipboard
val name: Output<String>

Field 'name' has been deprecated from provider version 1.122.0. New field 'network_acl_name' instead.

Link copied to clipboard
val networkAclName: Output<String>

The name of the network ACL.The name must be 1 to 128 characters in length and cannot start with http:// or https.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The associated resource. See resources below.

Link copied to clipboard
val status: Output<String>

The status of the associated resource.

Link copied to clipboard
val tags: Output<Map<String, Any>>?

The tags of this resource.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val vpcId: Output<String>

The ID of the associated VPC. The following arguments will be discarded. Please use new fields as soon as possible: