UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

130 lines 5.53 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.NetworkAclRule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Creates an entry (a rule) in a network ACL with the specified rule number. * * > **NOTE on Network ACLs and Network ACL Rules:** This provider currently * provides both a standalone Network ACL Rule resource and a Network ACL resource with rules * defined in-line. At this time you cannot use a Network ACL with in-line rules * in conjunction with any Network ACL Rule resources. Doing so will cause * a conflict of rule settings and will overwrite rules. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const bar = new aws.ec2.NetworkAcl("bar", {vpcId: foo.id}); * const barNetworkAclRule = new aws.ec2.NetworkAclRule("bar", { * networkAclId: bar.id, * ruleNumber: 200, * egress: false, * protocol: "tcp", * ruleAction: "allow", * cidrBlock: foo.cidrBlock, * fromPort: 22, * toPort: 22, * }); * ``` * * > **Note:** One of either `cidrBlock` or `ipv6CidrBlock` is required. * * ## Import * * Using the procotol's decimal value: * * __Using `pulumi import` to import__ individual rules using `NETWORK_ACL_ID:RULE_NUMBER:PROTOCOL:EGRESS`, where `PROTOCOL` can be a decimal (such as "6") or string (such as "tcp") value. For example: * * Using the procotol's string value: * * ```sh * $ pulumi import aws:ec2/networkAclRule:NetworkAclRule my_rule acl-7aaabd18:100:tcp:false * ``` * Using the procotol's decimal value: * * ```sh * $ pulumi import aws:ec2/networkAclRule:NetworkAclRule my_rule acl-7aaabd18:100:6:false * ``` */ class NetworkAclRule extends pulumi.CustomResource { /** * Get an existing NetworkAclRule resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new NetworkAclRule(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of NetworkAclRule. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === NetworkAclRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["cidrBlock"] = state?.cidrBlock; resourceInputs["egress"] = state?.egress; resourceInputs["fromPort"] = state?.fromPort; resourceInputs["icmpCode"] = state?.icmpCode; resourceInputs["icmpType"] = state?.icmpType; resourceInputs["ipv6CidrBlock"] = state?.ipv6CidrBlock; resourceInputs["networkAclId"] = state?.networkAclId; resourceInputs["protocol"] = state?.protocol; resourceInputs["region"] = state?.region; resourceInputs["ruleAction"] = state?.ruleAction; resourceInputs["ruleNumber"] = state?.ruleNumber; resourceInputs["toPort"] = state?.toPort; } else { const args = argsOrState; if (args?.networkAclId === undefined && !opts.urn) { throw new Error("Missing required property 'networkAclId'"); } if (args?.protocol === undefined && !opts.urn) { throw new Error("Missing required property 'protocol'"); } if (args?.ruleAction === undefined && !opts.urn) { throw new Error("Missing required property 'ruleAction'"); } if (args?.ruleNumber === undefined && !opts.urn) { throw new Error("Missing required property 'ruleNumber'"); } resourceInputs["cidrBlock"] = args?.cidrBlock; resourceInputs["egress"] = args?.egress; resourceInputs["fromPort"] = args?.fromPort; resourceInputs["icmpCode"] = args?.icmpCode; resourceInputs["icmpType"] = args?.icmpType; resourceInputs["ipv6CidrBlock"] = args?.ipv6CidrBlock; resourceInputs["networkAclId"] = args?.networkAclId; resourceInputs["protocol"] = args?.protocol; resourceInputs["region"] = args?.region; resourceInputs["ruleAction"] = args?.ruleAction; resourceInputs["ruleNumber"] = args?.ruleNumber; resourceInputs["toPort"] = args?.toPort; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(NetworkAclRule.__pulumiType, name, resourceInputs, opts); } } exports.NetworkAclRule = NetworkAclRule; /** @internal */ NetworkAclRule.__pulumiType = 'aws:ec2/networkAclRule:NetworkAclRule'; //# sourceMappingURL=networkAclRule.js.map