1. Registry
  2. Packages
  3. AWS
  4. API Docs
  5. networksecuritymanager
  6. Policy
Viewing docs for AWS v7.55.0
published on Friday, Nov 13, 2026 by Pulumi
aws logo aws logo
Viewing docs for AWS v7.55.0
published on Friday, Nov 13, 2026 by Pulumi

    Manages an AWS Network Security Manager Policy. A policy combines templates and rules with enforcement settings for a firewall type, such as AWS WAF or AWS Shield Advanced.

    Changes to a policy are published unless isPublished is false.

    Example Usage

    AWS WAF Policy

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.networksecuritymanager.Policy("example", {
        configuration: {
            wafConfig: {
                conflictResolution: "MERGE_WHERE_APPLICABLE",
                existingCustomerWebAclResolution: "RETROFIT",
            },
            remediationEnabled: true,
            resourcesCleanUp: true,
        },
        templateOrRules: [{
            ruleIdentifier: exampleAwsNetworksecuritymanagerRule.arn,
        }],
        name: "baseline-waf",
        firewallType: "WAF",
        priority: 1,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.networksecuritymanager.Policy("example",
        configuration={
            "waf_config": {
                "conflict_resolution": "MERGE_WHERE_APPLICABLE",
                "existing_customer_web_acl_resolution": "RETROFIT",
            },
            "remediation_enabled": True,
            "resources_clean_up": True,
        },
        template_or_rules=[{
            "rule_identifier": example_aws_networksecuritymanager_rule["arn"],
        }],
        name="baseline-waf",
        firewall_type="WAF",
        priority=1)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/networksecuritymanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := networksecuritymanager.NewPolicy(ctx, "example", &networksecuritymanager.PolicyArgs{
    			Configuration: &networksecuritymanager.PolicyConfigurationArgs{
    				WafConfig: &networksecuritymanager.PolicyConfigurationWafConfigArgs{
    					ConflictResolution:               pulumi.String("MERGE_WHERE_APPLICABLE"),
    					ExistingCustomerWebAclResolution: pulumi.String("RETROFIT"),
    				},
    				RemediationEnabled: pulumi.Bool(true),
    				ResourcesCleanUp:   pulumi.Bool(true),
    			},
    			TemplateOrRules: networksecuritymanager.PolicyTemplateOrRuleArray{
    				&networksecuritymanager.PolicyTemplateOrRuleArgs{
    					RuleIdentifier: pulumi.Any(exampleAwsNetworksecuritymanagerRule.Arn),
    				},
    			},
    			Name:         pulumi.String("baseline-waf"),
    			FirewallType: pulumi.String("WAF"),
    			Priority:     pulumi.Int(1),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.NetworkSecurityManager.Policy("example", new()
        {
            Configuration = new Aws.NetworkSecurityManager.Inputs.PolicyConfigurationArgs
            {
                WafConfig = new Aws.NetworkSecurityManager.Inputs.PolicyConfigurationWafConfigArgs
                {
                    ConflictResolution = "MERGE_WHERE_APPLICABLE",
                    ExistingCustomerWebAclResolution = "RETROFIT",
                },
                RemediationEnabled = true,
                ResourcesCleanUp = true,
            },
            TemplateOrRules = new[]
            {
                new Aws.NetworkSecurityManager.Inputs.PolicyTemplateOrRuleArgs
                {
                    RuleIdentifier = exampleAwsNetworksecuritymanagerRule.Arn,
                },
            },
            Name = "baseline-waf",
            FirewallType = "WAF",
            Priority = 1,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.networksecuritymanager.Policy;
    import com.pulumi.aws.networksecuritymanager.PolicyArgs;
    import com.pulumi.aws.networksecuritymanager.inputs.PolicyConfigurationArgs;
    import com.pulumi.aws.networksecuritymanager.inputs.PolicyConfigurationWafConfigArgs;
    import com.pulumi.aws.networksecuritymanager.inputs.PolicyTemplateOrRuleArgs;
    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 example = new Policy("example", PolicyArgs.builder()
                .configuration(PolicyConfigurationArgs.builder()
                    .wafConfig(PolicyConfigurationWafConfigArgs.builder()
                        .conflictResolution("MERGE_WHERE_APPLICABLE")
                        .existingCustomerWebAclResolution("RETROFIT")
                        .build())
                    .remediationEnabled(true)
                    .resourcesCleanUp(true)
                    .build())
                .templateOrRules(PolicyTemplateOrRuleArgs.builder()
                    .ruleIdentifier(exampleAwsNetworksecuritymanagerRule.get("arn"))
                    .build())
                .name("baseline-waf")
                .firewallType("WAF")
                .priority(1)
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:networksecuritymanager:Policy
        properties:
          configuration:
            wafConfig:
              conflictResolution: MERGE_WHERE_APPLICABLE
              existingCustomerWebAclResolution: RETROFIT
            remediationEnabled: true
            resourcesCleanUp: true
          templateOrRules:
            - ruleIdentifier: ${exampleAwsNetworksecuritymanagerRule.arn}
          name: baseline-waf
          firewallType: WAF
          priority: 1
    
    terraform {
      required_providers {
        aws = {
          source = "pulumi/aws"
        }
      }
    }
    
    resource "aws_networksecuritymanager_policy" "example" {
      lifecycle {
        create_before_destroy = true
      }
      configuration {
        waf_config {
          conflict_resolution                  = "MERGE_WHERE_APPLICABLE"
          existing_customer_web_acl_resolution = "RETROFIT"
        }
        remediation_enabled = true
        resources_clean_up  = true
      }
      template_or_rule {
        rule_identifier = exampleAwsNetworksecuritymanagerRule.arn
      }
      name          = "baseline-waf"
      firewall_type = "WAF"
      priority      = 1
    }
    

    AWS Shield Advanced Policy

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.networksecuritymanager.Policy("example", {
        configuration: {
            remediationEnabled: true,
            resourcesCleanUp: true,
        },
        name: "baseline-shield",
        firewallType: "SHIELD_ADVANCED",
        priority: 2,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.networksecuritymanager.Policy("example",
        configuration={
            "remediation_enabled": True,
            "resources_clean_up": True,
        },
        name="baseline-shield",
        firewall_type="SHIELD_ADVANCED",
        priority=2)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/networksecuritymanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := networksecuritymanager.NewPolicy(ctx, "example", &networksecuritymanager.PolicyArgs{
    			Configuration: &networksecuritymanager.PolicyConfigurationArgs{
    				RemediationEnabled: pulumi.Bool(true),
    				ResourcesCleanUp:   pulumi.Bool(true),
    			},
    			Name:         pulumi.String("baseline-shield"),
    			FirewallType: pulumi.String("SHIELD_ADVANCED"),
    			Priority:     pulumi.Int(2),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.NetworkSecurityManager.Policy("example", new()
        {
            Configuration = new Aws.NetworkSecurityManager.Inputs.PolicyConfigurationArgs
            {
                RemediationEnabled = true,
                ResourcesCleanUp = true,
            },
            Name = "baseline-shield",
            FirewallType = "SHIELD_ADVANCED",
            Priority = 2,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.networksecuritymanager.Policy;
    import com.pulumi.aws.networksecuritymanager.PolicyArgs;
    import com.pulumi.aws.networksecuritymanager.inputs.PolicyConfigurationArgs;
    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 example = new Policy("example", PolicyArgs.builder()
                .configuration(PolicyConfigurationArgs.builder()
                    .remediationEnabled(true)
                    .resourcesCleanUp(true)
                    .build())
                .name("baseline-shield")
                .firewallType("SHIELD_ADVANCED")
                .priority(2)
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:networksecuritymanager:Policy
        properties:
          configuration:
            remediationEnabled: true
            resourcesCleanUp: true
          name: baseline-shield
          firewallType: SHIELD_ADVANCED
          priority: 2
    
    terraform {
      required_providers {
        aws = {
          source = "pulumi/aws"
        }
      }
    }
    
    resource "aws_networksecuritymanager_policy" "example" {
      lifecycle {
        create_before_destroy = true
      }
      configuration {
        remediation_enabled = true
        resources_clean_up  = true
      }
      name          = "baseline-shield"
      firewall_type = "SHIELD_ADVANCED"
      priority      = 2
    }
    

    Create Policy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
    @overload
    def Policy(resource_name: str,
               args: PolicyArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Policy(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               configuration: Optional[PolicyConfigurationArgs] = None,
               firewall_type: Optional[str] = None,
               priority: Optional[int] = None,
               description: Optional[str] = None,
               is_published: Optional[bool] = None,
               name: Optional[str] = None,
               region: Optional[str] = None,
               tags: Optional[Mapping[str, str]] = None,
               template_or_rules: Optional[Sequence[PolicyTemplateOrRuleArgs]] = None)
    func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
    public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
    public Policy(String name, PolicyArgs args)
    public Policy(String name, PolicyArgs args, CustomResourceOptions options)
    
    type: aws:networksecuritymanager:Policy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "aws_networksecuritymanager_policy" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args PolicyArgs
    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 PolicyArgs
    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 PolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyArgs
    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 examplepolicyResourceResourceFromNetworksecuritymanagerpolicy = new Aws.NetworkSecurityManager.Policy("examplepolicyResourceResourceFromNetworksecuritymanagerpolicy", new()
    {
        Configuration = new Aws.NetworkSecurityManager.Inputs.PolicyConfigurationArgs
        {
            RemediationEnabled = false,
            ResourcesCleanUp = false,
            WafConfig = new Aws.NetworkSecurityManager.Inputs.PolicyConfigurationWafConfigArgs
            {
                ConflictResolution = "string",
                ExistingCustomerWebAclResolution = "string",
            },
        },
        FirewallType = "string",
        Priority = 0,
        Description = "string",
        IsPublished = false,
        Name = "string",
        Region = "string",
        Tags = 
        {
            { "string", "string" },
        },
        TemplateOrRules = new[]
        {
            new Aws.NetworkSecurityManager.Inputs.PolicyTemplateOrRuleArgs
            {
                RuleIdentifier = "string",
                TemplateIdentifier = "string",
            },
        },
    });
    
    example, err := networksecuritymanager.NewPolicy(ctx, "examplepolicyResourceResourceFromNetworksecuritymanagerpolicy", &networksecuritymanager.PolicyArgs{
    	Configuration: &networksecuritymanager.PolicyConfigurationArgs{
    		RemediationEnabled: pulumi.Bool(false),
    		ResourcesCleanUp:   pulumi.Bool(false),
    		WafConfig: &networksecuritymanager.PolicyConfigurationWafConfigArgs{
    			ConflictResolution:               pulumi.String("string"),
    			ExistingCustomerWebAclResolution: pulumi.String("string"),
    		},
    	},
    	FirewallType: pulumi.String("string"),
    	Priority:     pulumi.Int(0),
    	Description:  pulumi.String("string"),
    	IsPublished:  pulumi.Bool(false),
    	Name:         pulumi.String("string"),
    	Region:       pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	TemplateOrRules: networksecuritymanager.PolicyTemplateOrRuleArray{
    		&networksecuritymanager.PolicyTemplateOrRuleArgs{
    			RuleIdentifier:     pulumi.String("string"),
    			TemplateIdentifier: pulumi.String("string"),
    		},
    	},
    })
    
    resource "aws_networksecuritymanager_policy" "examplepolicyResourceResourceFromNetworksecuritymanagerpolicy" {
      lifecycle {
        create_before_destroy = true
      }
      configuration = {
        remediation_enabled = false
        resources_clean_up  = false
        waf_config = {
          conflict_resolution                  = "string"
          existing_customer_web_acl_resolution = "string"
        }
      }
      firewall_type = "string"
      priority      = 0
      description   = "string"
      is_published  = false
      name          = "string"
      region        = "string"
      tags = {
        "string" = "string"
      }
      template_or_rules {
        rule_identifier     = "string"
        template_identifier = "string"
      }
    }
    
    var examplepolicyResourceResourceFromNetworksecuritymanagerpolicy = new com.pulumi.aws.networksecuritymanager.Policy("examplepolicyResourceResourceFromNetworksecuritymanagerpolicy", com.pulumi.aws.networksecuritymanager.PolicyArgs.builder()
        .configuration(PolicyConfigurationArgs.builder()
            .remediationEnabled(false)
            .resourcesCleanUp(false)
            .wafConfig(PolicyConfigurationWafConfigArgs.builder()
                .conflictResolution("string")
                .existingCustomerWebAclResolution("string")
                .build())
            .build())
        .firewallType("string")
        .priority(0)
        .description("string")
        .isPublished(false)
        .name("string")
        .region("string")
        .tags(Map.of("string", "string"))
        .templateOrRules(PolicyTemplateOrRuleArgs.builder()
            .ruleIdentifier("string")
            .templateIdentifier("string")
            .build())
        .build());
    
    examplepolicy_resource_resource_from_networksecuritymanagerpolicy = aws.networksecuritymanager.Policy("examplepolicyResourceResourceFromNetworksecuritymanagerpolicy",
        configuration={
            "remediation_enabled": False,
            "resources_clean_up": False,
            "waf_config": {
                "conflict_resolution": "string",
                "existing_customer_web_acl_resolution": "string",
            },
        },
        firewall_type="string",
        priority=0,
        description="string",
        is_published=False,
        name="string",
        region="string",
        tags={
            "string": "string",
        },
        template_or_rules=[{
            "rule_identifier": "string",
            "template_identifier": "string",
        }])
    
    const examplepolicyResourceResourceFromNetworksecuritymanagerpolicy = new aws.networksecuritymanager.Policy("examplepolicyResourceResourceFromNetworksecuritymanagerpolicy", {
        configuration: {
            remediationEnabled: false,
            resourcesCleanUp: false,
            wafConfig: {
                conflictResolution: "string",
                existingCustomerWebAclResolution: "string",
            },
        },
        firewallType: "string",
        priority: 0,
        description: "string",
        isPublished: false,
        name: "string",
        region: "string",
        tags: {
            string: "string",
        },
        templateOrRules: [{
            ruleIdentifier: "string",
            templateIdentifier: "string",
        }],
    });
    
    type: aws:networksecuritymanager:Policy
    properties:
        configuration:
            remediationEnabled: false
            resourcesCleanUp: false
            wafConfig:
                conflictResolution: string
                existingCustomerWebAclResolution: string
        description: string
        firewallType: string
        isPublished: false
        name: string
        priority: 0
        region: string
        tags:
            string: string
        templateOrRules:
            - ruleIdentifier: string
              templateIdentifier: string
    

    Policy 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 Policy resource accepts the following input properties:

    Configuration PolicyConfiguration
    Settings that control the policy's behavior. See configuration below.
    FirewallType string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    Priority int

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    Description string
    Description of the policy.
    IsPublished bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    Name string
    Name of the policy. Changing this value forces a new resource.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags Dictionary<string, string>
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TemplateOrRules List<PolicyTemplateOrRule>

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    Configuration PolicyConfigurationArgs
    Settings that control the policy's behavior. See configuration below.
    FirewallType string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    Priority int

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    Description string
    Description of the policy.
    IsPublished bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    Name string
    Name of the policy. Changing this value forces a new resource.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags map[string]string
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TemplateOrRules []PolicyTemplateOrRuleArgs

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    configuration object
    Settings that control the policy's behavior. See configuration below.
    firewall_type string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    priority number

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    description string
    Description of the policy.
    is_published bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name string
    Name of the policy. Changing this value forces a new resource.
    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags map(string)
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    template_or_rules list(object)

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    configuration PolicyConfiguration
    Settings that control the policy's behavior. See configuration below.
    firewallType String
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    priority Integer

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    description String
    Description of the policy.
    isPublished Boolean
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name String
    Name of the policy. Changing this value forces a new resource.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String,String>
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    templateOrRules List<PolicyTemplateOrRule>

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    configuration PolicyConfiguration
    Settings that control the policy's behavior. See configuration below.
    firewallType string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    priority number

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    description string
    Description of the policy.
    isPublished boolean
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name string
    Name of the policy. Changing this value forces a new resource.
    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags {[key: string]: string}
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    templateOrRules PolicyTemplateOrRule[]

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    configuration PolicyConfigurationArgs
    Settings that control the policy's behavior. See configuration below.
    firewall_type str
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    priority int

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    description str
    Description of the policy.
    is_published bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name str
    Name of the policy. Changing this value forces a new resource.
    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Mapping[str, str]
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    template_or_rules Sequence[PolicyTemplateOrRuleArgs]

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    configuration Property Map
    Settings that control the policy's behavior. See configuration below.
    firewallType String
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    priority Number

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    description String
    Description of the policy.
    isPublished Boolean
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name String
    Name of the policy. Changing this value forces a new resource.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String>
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    templateOrRules List<Property Map>

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:

    Arn string
    ARN of the policy.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll Dictionary<string, string>
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    Arn string
    ARN of the policy.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll map[string]string
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    arn string
    ARN of the policy.
    id string
    The provider-assigned unique ID for this managed resource.
    tags_all map(string)
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    arn String
    ARN of the policy.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String,String>
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    arn string
    ARN of the policy.
    id string
    The provider-assigned unique ID for this managed resource.
    tagsAll {[key: string]: string}
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    arn str
    ARN of the policy.
    id str
    The provider-assigned unique ID for this managed resource.
    tags_all Mapping[str, str]
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    arn String
    ARN of the policy.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String>
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

    Look up Existing Policy Resource

    Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            configuration: Optional[PolicyConfigurationArgs] = None,
            description: Optional[str] = None,
            firewall_type: Optional[str] = None,
            is_published: Optional[bool] = None,
            name: Optional[str] = None,
            priority: Optional[int] = None,
            region: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None,
            template_or_rules: Optional[Sequence[PolicyTemplateOrRuleArgs]] = None) -> Policy
    func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
    public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
    public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)
    resources:  existingPolicy:    type: aws:networksecuritymanager:Policy    get:      id: ${id}
    import {
      to = aws_networksecuritymanager_policy.example
      id = "${id}"
    }
    
    name string
    The unique name of the resulting resource.
    id Input<ID>
    The unique provider ID of the resource to look up.
    state PolicyState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resulting resource.
    id str
    The unique provider ID of the resource to look up.
    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 resulting resource.
    id IDInput
    The unique provider ID of the resource to look up.
    state PolicyState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resulting resource.
    id Input<string>
    The unique provider ID of the resource to look up.
    state PolicyState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resulting resource.
    id Output<String>
    The unique provider ID of the resource to look up.
    state PolicyState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    options CustomResourceOptions
    Bag of options to control resource's behavior.
    The following state arguments are supported:
    Arn string
    ARN of the policy.
    Configuration PolicyConfiguration
    Settings that control the policy's behavior. See configuration below.
    Description string
    Description of the policy.
    FirewallType string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    IsPublished bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    Name string
    Name of the policy. Changing this value forces a new resource.
    Priority int

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags Dictionary<string, string>
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll Dictionary<string, string>
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    TemplateOrRules List<PolicyTemplateOrRule>

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    Arn string
    ARN of the policy.
    Configuration PolicyConfigurationArgs
    Settings that control the policy's behavior. See configuration below.
    Description string
    Description of the policy.
    FirewallType string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    IsPublished bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    Name string
    Name of the policy. Changing this value forces a new resource.
    Priority int

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags map[string]string
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll map[string]string
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    TemplateOrRules []PolicyTemplateOrRuleArgs

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    arn string
    ARN of the policy.
    configuration object
    Settings that control the policy's behavior. See configuration below.
    description string
    Description of the policy.
    firewall_type string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    is_published bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name string
    Name of the policy. Changing this value forces a new resource.
    priority number

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags map(string)
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all map(string)
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    template_or_rules list(object)

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    arn String
    ARN of the policy.
    configuration PolicyConfiguration
    Settings that control the policy's behavior. See configuration below.
    description String
    Description of the policy.
    firewallType String
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    isPublished Boolean
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name String
    Name of the policy. Changing this value forces a new resource.
    priority Integer

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String,String>
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String,String>
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    templateOrRules List<PolicyTemplateOrRule>

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    arn string
    ARN of the policy.
    configuration PolicyConfiguration
    Settings that control the policy's behavior. See configuration below.
    description string
    Description of the policy.
    firewallType string
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    isPublished boolean
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name string
    Name of the policy. Changing this value forces a new resource.
    priority number

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags {[key: string]: string}
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll {[key: string]: string}
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    templateOrRules PolicyTemplateOrRule[]

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    arn str
    ARN of the policy.
    configuration PolicyConfigurationArgs
    Settings that control the policy's behavior. See configuration below.
    description str
    Description of the policy.
    firewall_type str
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    is_published bool
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name str
    Name of the policy. Changing this value forces a new resource.
    priority int

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Mapping[str, str]
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all Mapping[str, str]
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    template_or_rules Sequence[PolicyTemplateOrRuleArgs]

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    arn String
    ARN of the policy.
    configuration Property Map
    Settings that control the policy's behavior. See configuration below.
    description String
    Description of the policy.
    firewallType String
    Firewall type of the policy. Valid values: WAF, SHIELD_ADVANCED. Changing this value forces a new resource.
    isPublished Boolean
    Whether to publish the policy. When true, the policy is saved in the published (ACTIVE) state. When false, it is saved as a draft (DRAFT); for a published policy, the draft is saved on top of the published version. Defaults to true.
    name String
    Name of the policy. Changing this value forces a new resource.
    priority Number

    Priority of the policy. A lower number indicates a higher priority. Minimum value of 1. Must be unique across policies in the AWS account.

    The following arguments are optional:

    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String>
    Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String>
    Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
    templateOrRules List<Property Map>

    Ordered list of templates and rules to associate with the policy. For WAF policies, specify 1 to 100 entries, of which at most 2 can be templates. Must be omitted for SHIELD_ADVANCED policies. See templateOrRule below.

    Note: A rule or template referenced by a published policy cannot be deleted. Configure createBeforeDestroy on referenced rule and template resources so that a replacement is associated with the policy before the old resource is deleted.

    Supporting Types

    PolicyConfiguration, PolicyConfigurationArgs

    RemediationEnabled bool
    Whether to automatically remediate noncompliant resources.
    ResourcesCleanUp bool
    Whether to automatically remove the resources the service created when they are no longer needed. The service currently only accepts true.
    WafConfig PolicyConfigurationWafConfig
    AWS WAF-specific settings. Required for WAF policies. See wafConfig below.
    RemediationEnabled bool
    Whether to automatically remediate noncompliant resources.
    ResourcesCleanUp bool
    Whether to automatically remove the resources the service created when they are no longer needed. The service currently only accepts true.
    WafConfig PolicyConfigurationWafConfig
    AWS WAF-specific settings. Required for WAF policies. See wafConfig below.
    remediation_enabled bool
    Whether to automatically remediate noncompliant resources.
    resources_clean_up bool
    Whether to automatically remove the resources the service created when they are no longer needed. The service currently only accepts true.
    waf_config object
    AWS WAF-specific settings. Required for WAF policies. See wafConfig below.
    remediationEnabled Boolean
    Whether to automatically remediate noncompliant resources.
    resourcesCleanUp Boolean
    Whether to automatically remove the resources the service created when they are no longer needed. The service currently only accepts true.
    wafConfig PolicyConfigurationWafConfig
    AWS WAF-specific settings. Required for WAF policies. See wafConfig below.
    remediationEnabled boolean
    Whether to automatically remediate noncompliant resources.
    resourcesCleanUp boolean
    Whether to automatically remove the resources the service created when they are no longer needed. The service currently only accepts true.
    wafConfig PolicyConfigurationWafConfig
    AWS WAF-specific settings. Required for WAF policies. See wafConfig below.
    remediation_enabled bool
    Whether to automatically remediate noncompliant resources.
    resources_clean_up bool
    Whether to automatically remove the resources the service created when they are no longer needed. The service currently only accepts true.
    waf_config PolicyConfigurationWafConfig
    AWS WAF-specific settings. Required for WAF policies. See wafConfig below.
    remediationEnabled Boolean
    Whether to automatically remediate noncompliant resources.
    resourcesCleanUp Boolean
    Whether to automatically remove the resources the service created when they are no longer needed. The service currently only accepts true.
    wafConfig Property Map
    AWS WAF-specific settings. Required for WAF policies. See wafConfig below.

    PolicyConfigurationWafConfig, PolicyConfigurationWafConfigArgs

    ConflictResolution string
    Conflict-resolution strategy. Valid values: MERGE_WHERE_APPLICABLE.
    ExistingCustomerWebAclResolution string
    How remediation is handled when a resource already has a customer-created web ACL. Valid values: RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION.
    ConflictResolution string
    Conflict-resolution strategy. Valid values: MERGE_WHERE_APPLICABLE.
    ExistingCustomerWebAclResolution string
    How remediation is handled when a resource already has a customer-created web ACL. Valid values: RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION.
    conflict_resolution string
    Conflict-resolution strategy. Valid values: MERGE_WHERE_APPLICABLE.
    existing_customer_web_acl_resolution string
    How remediation is handled when a resource already has a customer-created web ACL. Valid values: RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION.
    conflictResolution String
    Conflict-resolution strategy. Valid values: MERGE_WHERE_APPLICABLE.
    existingCustomerWebAclResolution String
    How remediation is handled when a resource already has a customer-created web ACL. Valid values: RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION.
    conflictResolution string
    Conflict-resolution strategy. Valid values: MERGE_WHERE_APPLICABLE.
    existingCustomerWebAclResolution string
    How remediation is handled when a resource already has a customer-created web ACL. Valid values: RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION.
    conflict_resolution str
    Conflict-resolution strategy. Valid values: MERGE_WHERE_APPLICABLE.
    existing_customer_web_acl_resolution str
    How remediation is handled when a resource already has a customer-created web ACL. Valid values: RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION.
    conflictResolution String
    Conflict-resolution strategy. Valid values: MERGE_WHERE_APPLICABLE.
    existingCustomerWebAclResolution String
    How remediation is handled when a resource already has a customer-created web ACL. Valid values: RETROFIT, OVERRIDE_ASSOCIATION, NO_REMEDIATION.

    PolicyTemplateOrRule, PolicyTemplateOrRuleArgs

    RuleIdentifier string
    ARN of the rule.
    TemplateIdentifier string
    ARN of the template.
    RuleIdentifier string
    ARN of the rule.
    TemplateIdentifier string
    ARN of the template.
    rule_identifier string
    ARN of the rule.
    template_identifier string
    ARN of the template.
    ruleIdentifier String
    ARN of the rule.
    templateIdentifier String
    ARN of the template.
    ruleIdentifier string
    ARN of the rule.
    templateIdentifier string
    ARN of the template.
    rule_identifier str
    ARN of the rule.
    template_identifier str
    ARN of the template.
    ruleIdentifier String
    ARN of the rule.
    templateIdentifier String
    ARN of the template.

    Import

    Identity Schema

    Required

    • arn (String) ARN of the policy.

    Using pulumi import, import Network Security Manager Policy using the arn. For example:

    $ pulumi import aws:networksecuritymanager/policy:Policy example arn:aws:network-security-manager:us-east-1:123456789012:policy:abcd1234efgh
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo aws logo
    Viewing docs for AWS v7.55.0
    published on Friday, Nov 13, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial