Class NetworkAclRule


  • public class NetworkAclRule
    extends com.pulumi.resources.CustomResource
    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
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ec2.NetworkAcl;
     import com.pulumi.aws.ec2.NetworkAclArgs;
     import com.pulumi.aws.ec2.NetworkAclRule;
     import com.pulumi.aws.ec2.NetworkAclRuleArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     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) {
             var bar = new NetworkAcl("bar", NetworkAclArgs.builder()
                 .vpcId(foo.id())
                 .build());
     
             var barNetworkAclRule = new NetworkAclRule("barNetworkAclRule", NetworkAclRuleArgs.builder()
                 .networkAclId(bar.id())
                 .ruleNumber(200)
                 .egress(false)
                 .protocol("tcp")
                 .ruleAction("allow")
                 .cidrBlock(foo.cidrBlock())
                 .fromPort(22)
                 .toPort(22)
                 .build());
     
         }
     }
     
     
    > **Note:** One of either `cidrBlock` or `ipv6CidrBlock` is required. ## Import ### Identity Schema #### Required * `egress` (Boolean) Indicates whether this is an egress rule. * `networkAclId` (String) The ID of the network ACL. * `protocol` (String) The protocol. This can be a decimal value such as `6` or a keyword such as `tcp`. * `ruleNumber` (Number) The rule number for the entry. #### Optional * `accountId` (String) AWS account where this resource is managed. * `region` (String) Region where this resource is managed. Using the protocol's decimal value: Using `pulumi import`, 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 protocol's string value: ```sh $ pulumi import aws:ec2/networkAclRule:NetworkAclRule my_rule acl-7aaabd18:100:tcp:false ``` Using the protocol's decimal value: ```sh $ pulumi import aws:ec2/networkAclRule:NetworkAclRule my_rule acl-7aaabd18:100:6:false ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> cidrBlock()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> egress()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> fromPort()  
      static NetworkAclRule get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, NetworkAclRuleState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> icmpCode()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> icmpType()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> ipv6CidrBlock()  
      com.pulumi.core.Output<java.lang.String> networkAclId()  
      com.pulumi.core.Output<java.lang.String> protocol()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> ruleAction()  
      com.pulumi.core.Output<java.lang.Integer> ruleNumber()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> toPort()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NetworkAclRule

        public NetworkAclRule​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • NetworkAclRule

        public NetworkAclRule​(java.lang.String name,
                              NetworkAclRuleArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • NetworkAclRule

        public NetworkAclRule​(java.lang.String name,
                              NetworkAclRuleArgs args,
                              @Nullable
                              com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • cidrBlock

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> cidrBlock()
        Returns:
        The network range to allow or deny, in CIDR notation (for example 172.16.0.0/24 ).
      • egress

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> egress()
        Returns:
        Indicates whether this is an egress rule (rule is applied to traffic leaving the subnet). Default `false`.
      • fromPort

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> fromPort()
        Returns:
        The from port to match.
      • icmpCode

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> icmpCode()
        Returns:
        ICMP protocol: The ICMP code. Required if specifying ICMP for the protocolE.g., -1 > **NOTE:** If the value of `protocol` is `-1` or `all`, the `fromPort` and `toPort` values will be ignored and the rule will apply to all ports. > **NOTE:** If the value of `icmpType` is `-1` (which results in a wildcard ICMP type), the `icmpCode` must also be set to `-1` (wildcard ICMP code). > Note: For more information on ICMP types and codes, see here: https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml
      • icmpType

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> icmpType()
        Returns:
        ICMP protocol: The ICMP type. Required if specifying ICMP for the protocolE.g., -1
      • ipv6CidrBlock

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> ipv6CidrBlock()
        Returns:
        The IPv6 CIDR block to allow or deny.
      • networkAclId

        public com.pulumi.core.Output<java.lang.String> networkAclId()
        Returns:
        The ID of the network ACL.
      • protocol

        public com.pulumi.core.Output<java.lang.String> protocol()
        Returns:
        The protocol. A value of -1 means all protocols.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • ruleAction

        public com.pulumi.core.Output<java.lang.String> ruleAction()
        Returns:
        Indicates whether to allow or deny the traffic that matches the rule. Accepted values: `allow` | `deny`
      • ruleNumber

        public com.pulumi.core.Output<java.lang.Integer> ruleNumber()
        Returns:
        The rule number for the entry (for example, 100). ACL entries are processed in ascending order by rule number.
      • toPort

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> toPort()
        Returns:
        The to port to match.
      • get

        public static NetworkAclRule get​(java.lang.String name,
                                         com.pulumi.core.Output<java.lang.String> id,
                                         @Nullable
                                         NetworkAclRuleState state,
                                         @Nullable
                                         com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.