Class Policy


  • public class Policy
    extends com.pulumi.resources.CustomResource
    Provides a resource to create an AWS Firewall Manager policy. You need to be using AWS organizations and have enabled the Firewall Manager administrator account. > **NOTE:** Due to limitations with testing, we provide it as best effort. If you find it useful, and have the ability to help test or notice issues, consider reaching out to us on GitHub. ## Example Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.wafregional.RuleGroup;
     import com.pulumi.aws.wafregional.RuleGroupArgs;
     import com.pulumi.aws.fms.Policy;
     import com.pulumi.aws.fms.PolicyArgs;
     import com.pulumi.aws.fms.inputs.PolicySecurityServicePolicyDataArgs;
     import static com.pulumi.codegen.internal.Serialization.*;
     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 exampleRuleGroup = new RuleGroup("exampleRuleGroup", RuleGroupArgs.builder()
                 .metricName("WAFRuleGroupExample")
                 .name("WAF-Rule-Group-Example")
                 .build());
     
             var example = new Policy("example", PolicyArgs.builder()
                 .securityServicePolicyData(PolicySecurityServicePolicyDataArgs.builder()
                     .type("WAF")
                     .managedServiceData(exampleRuleGroup.id().applyValue(_id -> serializeJson(
                         jsonObject(
                             jsonProperty("type", "WAF"),
                             jsonProperty("ruleGroups", jsonArray(jsonObject(
                                 jsonProperty("id", _id),
                                 jsonProperty("overrideAction", jsonObject(
                                     jsonProperty("type", "COUNT")
                                 ))
                             ))),
                             jsonProperty("defaultAction", jsonObject(
                                 jsonProperty("type", "BLOCK")
                             )),
                             jsonProperty("overrideCustomerWebACLAssociation", false)
                         ))))
                     .build())
                 .name("FMS-Policy-Example")
                 .excludeResourceTags(false)
                 .remediationEnabled(false)
                 .resourceType("AWS::ElasticLoadBalancingV2::LoadBalancer")
                 .tags(Map.of("Name", "example-fms-policy"))
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import Firewall Manager policies using the policy ID. For example: ```sh $ pulumi import aws:fms/policy:Policy example 5be49585-a7e3-4c49-dde1-a179fe4a619a ```
    • 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
    • Constructor Summary

      Constructors 
      Constructor Description
      Policy​(java.lang.String name)  
      Policy​(java.lang.String name, PolicyArgs args)  
      Policy​(java.lang.String name, PolicyArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> deleteAllPolicyResources()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> deleteUnusedFmManagedResources()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()  
      com.pulumi.core.Output<java.util.Optional<PolicyExcludeMap>> excludeMap()  
      com.pulumi.core.Output<java.lang.Boolean> excludeResourceTags()  
      static Policy get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, PolicyState 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<PolicyIncludeMap>> includeMap()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> policyUpdateToken()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> remediationEnabled()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> resourceSetIds()  
      com.pulumi.core.Output<java.lang.String> resourceTagLogicalOperator()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> resourceTags()  
      com.pulumi.core.Output<java.lang.String> resourceType()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> resourceTypeLists()  
      com.pulumi.core.Output<PolicySecurityServicePolicyData> securityServicePolicyData()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      • 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

      • Policy

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

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

        public Policy​(java.lang.String name,
                      PolicyArgs 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

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the policy.
      • deleteAllPolicyResources

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> deleteAllPolicyResources()
        Returns:
        If true, the request will also perform a clean-up process. Defaults to `true`. More information can be found here [AWS Firewall Manager delete policy](https://docs.aws.amazon.com/fms/2018-01-01/APIReference/API_DeletePolicy.html)
      • deleteUnusedFmManagedResources

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> deleteUnusedFmManagedResources()
        Returns:
        If true, Firewall Manager will automatically remove protections from resources that leave the policy scope. Defaults to `false`. More information can be found here [AWS Firewall Manager policy contents](https://docs.aws.amazon.com/fms/2018-01-01/APIReference/API_Policy.html)
      • description

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
        Returns:
        Description of the AWS Network Firewall firewall policy.
      • excludeMap

        public com.pulumi.core.Output<java.util.Optional<PolicyExcludeMap>> excludeMap()
        Returns:
        Map of lists of accounts and OUs to exclude from the policy. See the `excludeMap` block.
      • excludeResourceTags

        public com.pulumi.core.Output<java.lang.Boolean> excludeResourceTags()
        Returns:
        Whether resources with the tags specified in `resourceTags` are excluded from protection. If `true`, tagged resources are not protected by this policy. If `false` and `resourceTags` are populated, resources that contain those tags are protected by this policy.
      • includeMap

        public com.pulumi.core.Output<java.util.Optional<PolicyIncludeMap>> includeMap()
        Returns:
        Map of lists of accounts and OUs to include in the policy. See the `includeMap` block.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Friendly name of the AWS Firewall Manager Policy.
      • policyUpdateToken

        public com.pulumi.core.Output<java.lang.String> policyUpdateToken()
        Returns:
        Unique identifier for each update to the policy.
      • 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.
      • remediationEnabled

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> remediationEnabled()
        Returns:
        Whether the policy is automatically applied to resources that already exist in the account.
      • resourceSetIds

        public com.pulumi.core.Output<java.util.List<java.lang.String>> resourceSetIds()
        Returns:
        Set of resource set IDs associated with the policy.
      • resourceTagLogicalOperator

        public com.pulumi.core.Output<java.lang.String> resourceTagLogicalOperator()
        Returns:
        Controls how multiple resource tags are combined: with AND, so that a resource must have all tags to be included or excluded, or OR, so that a resource must have at least one tag. The valid values are `AND` and `OR`.
      • resourceTags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> resourceTags()
        Returns:
        Map of resource tags that, if present, filter protections on resources based on `excludeResourceTags`.
      • resourceType

        public com.pulumi.core.Output<java.lang.String> resourceType()
        Returns:
        Resource type to protect. Conflicts with `resourceTypeList`. See the [FMS API Reference](https://docs.aws.amazon.com/fms/2018-01-01/APIReference/API_Policy.html#fms-Type-Policy-ResourceType) for more information about supported values.
      • resourceTypeLists

        public com.pulumi.core.Output<java.util.List<java.lang.String>> resourceTypeLists()
        Returns:
        List of resource types to protect. Conflicts with `resourceType`. See the [FMS API Reference](https://docs.aws.amazon.com/fms/2018-01-01/APIReference/API_Policy.html#fms-Type-Policy-ResourceType) for more information about supported values. Lists with only one element are not supported, instead use `resourceType`.
      • securityServicePolicyData

        public com.pulumi.core.Output<PolicySecurityServicePolicyData> securityServicePolicyData()
        Returns:
        Objects to include in Security Service Policy Data. See the `securityServicePolicyData` block.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Key-value mapping of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • get

        public static Policy get​(java.lang.String name,
                                 com.pulumi.core.Output<java.lang.String> id,
                                 @Nullable
                                 PolicyState 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.