1. Packages
  2. Lacework Provider
  3. API Docs
  4. PolicyException
lacework 2.0.6 published on Monday, Apr 14, 2025 by lacework

lacework.PolicyException

Explore with Pulumi AI

lacework logo
lacework 2.0.6 published on Monday, Apr 14, 2025 by lacework

    Add exceptions to Lacework policies

    For more information, see the Adding Exceptions to a Policy.

    Example Usage

    Create a Lacework Policy Exception to exempt specified aws account from policy.

    import * as pulumi from "@pulumi/pulumi";
    import * as lacework from "@pulumi/lacework";
    
    const example = new lacework.PolicyException("example", {
        constraints: [{
            fieldKey: "accountIds",
            fieldValues: ["123456789"],
        }],
        description: "Exception for account 123456789",
        policyId: "lacework-global-73",
    });
    
    import pulumi
    import pulumi_lacework as lacework
    
    example = lacework.PolicyException("example",
        constraints=[{
            "field_key": "accountIds",
            "field_values": ["123456789"],
        }],
        description="Exception for account 123456789",
        policy_id="lacework-global-73")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/lacework/v2/lacework"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := lacework.NewPolicyException(ctx, "example", &lacework.PolicyExceptionArgs{
    			Constraints: lacework.PolicyExceptionConstraintArray{
    				&lacework.PolicyExceptionConstraintArgs{
    					FieldKey: pulumi.String("accountIds"),
    					FieldValues: pulumi.StringArray{
    						pulumi.String("123456789"),
    					},
    				},
    			},
    			Description: pulumi.String("Exception for account 123456789"),
    			PolicyId:    pulumi.String("lacework-global-73"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Lacework = Pulumi.Lacework;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Lacework.PolicyException("example", new()
        {
            Constraints = new[]
            {
                new Lacework.Inputs.PolicyExceptionConstraintArgs
                {
                    FieldKey = "accountIds",
                    FieldValues = new[]
                    {
                        "123456789",
                    },
                },
            },
            Description = "Exception for account 123456789",
            PolicyId = "lacework-global-73",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.lacework.PolicyException;
    import com.pulumi.lacework.PolicyExceptionArgs;
    import com.pulumi.lacework.inputs.PolicyExceptionConstraintArgs;
    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) {
            var example = new PolicyException("example", PolicyExceptionArgs.builder()
                .constraints(PolicyExceptionConstraintArgs.builder()
                    .fieldKey("accountIds")
                    .fieldValues("123456789")
                    .build())
                .description("Exception for account 123456789")
                .policyId("lacework-global-73")
                .build());
    
        }
    }
    
    resources:
      example:
        type: lacework:PolicyException
        properties:
          constraints:
            - fieldKey: accountIds
              fieldValues:
                - '123456789'
          description: Exception for account 123456789
          policyId: lacework-global-73
    

    Create a Lacework Policy Exception to exempt specified resourceTags from policy.

    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.lacework.PolicyException;
    import com.pulumi.lacework.PolicyExceptionArgs;
    import com.pulumi.lacework.inputs.PolicyExceptionConstraintArgs;
    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) {
            var example = new PolicyException("example", PolicyExceptionArgs.builder()
                .constraints(PolicyExceptionConstraintArgs.builder()
                    .fieldKey("resourceTags")
                    .fieldValuesMaps(                
                        PolicyExceptionConstraintFieldValuesMapArgs.builder()
                            .key("example_tag1")
                            .value(                        
                                "example_value",
                                "example_value1")
                            .build(),
                        PolicyExceptionConstraintFieldValuesMapArgs.builder()
                            .key("example_tag2")
                            .value(                        
                                "example_value",
                                "example_value1")
                            .build())
                    .build())
                .description("Exception for resource tag example1 and example2")
                .policyId("lacework-global-73")
                .build());
    
        }
    }
    
    resources:
      example:
        type: lacework:PolicyException
        properties:
          constraints:
            - fieldKey: resourceTags
              fieldValuesMaps:
                - key: example_tag1
                  value:
                    - example_value
                    - example_value1
                - key: example_tag2
                  value:
                    - example_value
                    - example_value1
          description: Exception for resource tag example1 and example2
          policyId: lacework-global-73
    

    Create PolicyException Resource

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

    Constructor syntax

    new PolicyException(name: string, args: PolicyExceptionArgs, opts?: CustomResourceOptions);
    @overload
    def PolicyException(resource_name: str,
                        args: PolicyExceptionArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def PolicyException(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        constraints: Optional[Sequence[PolicyExceptionConstraintArgs]] = None,
                        description: Optional[str] = None,
                        policy_id: Optional[str] = None)
    func NewPolicyException(ctx *Context, name string, args PolicyExceptionArgs, opts ...ResourceOption) (*PolicyException, error)
    public PolicyException(string name, PolicyExceptionArgs args, CustomResourceOptions? opts = null)
    public PolicyException(String name, PolicyExceptionArgs args)
    public PolicyException(String name, PolicyExceptionArgs args, CustomResourceOptions options)
    
    type: lacework:PolicyException
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PolicyExceptionArgs
    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 PolicyExceptionArgs
    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 PolicyExceptionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyExceptionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyExceptionArgs
    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 policyExceptionResource = new Lacework.PolicyException("policyExceptionResource", new()
    {
        Constraints = new[]
        {
            new Lacework.Inputs.PolicyExceptionConstraintArgs
            {
                FieldKey = "string",
                FieldValues = new[]
                {
                    "string",
                },
                FieldValuesMaps = new[]
                {
                    new Lacework.Inputs.PolicyExceptionConstraintFieldValuesMapArgs
                    {
                        Key = "string",
                        Values = new[]
                        {
                            "string",
                        },
                    },
                },
            },
        },
        Description = "string",
        PolicyId = "string",
    });
    
    example, err := lacework.NewPolicyException(ctx, "policyExceptionResource", &lacework.PolicyExceptionArgs{
    	Constraints: lacework.PolicyExceptionConstraintArray{
    		&lacework.PolicyExceptionConstraintArgs{
    			FieldKey: pulumi.String("string"),
    			FieldValues: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			FieldValuesMaps: lacework.PolicyExceptionConstraintFieldValuesMapArray{
    				&lacework.PolicyExceptionConstraintFieldValuesMapArgs{
    					Key: pulumi.String("string"),
    					Values: pulumi.StringArray{
    						pulumi.String("string"),
    					},
    				},
    			},
    		},
    	},
    	Description: pulumi.String("string"),
    	PolicyId:    pulumi.String("string"),
    })
    
    var policyExceptionResource = new PolicyException("policyExceptionResource", PolicyExceptionArgs.builder()
        .constraints(PolicyExceptionConstraintArgs.builder()
            .fieldKey("string")
            .fieldValues("string")
            .fieldValuesMaps(PolicyExceptionConstraintFieldValuesMapArgs.builder()
                .key("string")
                .values("string")
                .build())
            .build())
        .description("string")
        .policyId("string")
        .build());
    
    policy_exception_resource = lacework.PolicyException("policyExceptionResource",
        constraints=[{
            "field_key": "string",
            "field_values": ["string"],
            "field_values_maps": [{
                "key": "string",
                "values": ["string"],
            }],
        }],
        description="string",
        policy_id="string")
    
    const policyExceptionResource = new lacework.PolicyException("policyExceptionResource", {
        constraints: [{
            fieldKey: "string",
            fieldValues: ["string"],
            fieldValuesMaps: [{
                key: "string",
                values: ["string"],
            }],
        }],
        description: "string",
        policyId: "string",
    });
    
    type: lacework:PolicyException
    properties:
        constraints:
            - fieldKey: string
              fieldValues:
                - string
              fieldValuesMaps:
                - key: string
                  values:
                    - string
        description: string
        policyId: string
    

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

    Constraints List<PolicyExceptionConstraint>
    Constraint. See Constraint below for details.
    Description string
    The description of the policy exception.
    PolicyId string
    The id of the policy the exception is associated.
    Constraints []PolicyExceptionConstraintArgs
    Constraint. See Constraint below for details.
    Description string
    The description of the policy exception.
    PolicyId string
    The id of the policy the exception is associated.
    constraints List<PolicyExceptionConstraint>
    Constraint. See Constraint below for details.
    description String
    The description of the policy exception.
    policyId String
    The id of the policy the exception is associated.
    constraints PolicyExceptionConstraint[]
    Constraint. See Constraint below for details.
    description string
    The description of the policy exception.
    policyId string
    The id of the policy the exception is associated.
    constraints Sequence[PolicyExceptionConstraintArgs]
    Constraint. See Constraint below for details.
    description str
    The description of the policy exception.
    policy_id str
    The id of the policy the exception is associated.
    constraints List<Property Map>
    Constraint. See Constraint below for details.
    description String
    The description of the policy exception.
    policyId String
    The id of the policy the exception is associated.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedBy string
    UpdatedTime string
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedBy string
    UpdatedTime string
    id String
    The provider-assigned unique ID for this managed resource.
    updatedBy String
    updatedTime String
    id string
    The provider-assigned unique ID for this managed resource.
    updatedBy string
    updatedTime string
    id str
    The provider-assigned unique ID for this managed resource.
    updated_by str
    updated_time str
    id String
    The provider-assigned unique ID for this managed resource.
    updatedBy String
    updatedTime String

    Look up Existing PolicyException Resource

    Get an existing PolicyException 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?: PolicyExceptionState, opts?: CustomResourceOptions): PolicyException
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            constraints: Optional[Sequence[PolicyExceptionConstraintArgs]] = None,
            description: Optional[str] = None,
            policy_id: Optional[str] = None,
            updated_by: Optional[str] = None,
            updated_time: Optional[str] = None) -> PolicyException
    func GetPolicyException(ctx *Context, name string, id IDInput, state *PolicyExceptionState, opts ...ResourceOption) (*PolicyException, error)
    public static PolicyException Get(string name, Input<string> id, PolicyExceptionState? state, CustomResourceOptions? opts = null)
    public static PolicyException get(String name, Output<String> id, PolicyExceptionState state, CustomResourceOptions options)
    resources:  _:    type: lacework:PolicyException    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Constraints List<PolicyExceptionConstraint>
    Constraint. See Constraint below for details.
    Description string
    The description of the policy exception.
    PolicyId string
    The id of the policy the exception is associated.
    UpdatedBy string
    UpdatedTime string
    Constraints []PolicyExceptionConstraintArgs
    Constraint. See Constraint below for details.
    Description string
    The description of the policy exception.
    PolicyId string
    The id of the policy the exception is associated.
    UpdatedBy string
    UpdatedTime string
    constraints List<PolicyExceptionConstraint>
    Constraint. See Constraint below for details.
    description String
    The description of the policy exception.
    policyId String
    The id of the policy the exception is associated.
    updatedBy String
    updatedTime String
    constraints PolicyExceptionConstraint[]
    Constraint. See Constraint below for details.
    description string
    The description of the policy exception.
    policyId string
    The id of the policy the exception is associated.
    updatedBy string
    updatedTime string
    constraints Sequence[PolicyExceptionConstraintArgs]
    Constraint. See Constraint below for details.
    description str
    The description of the policy exception.
    policy_id str
    The id of the policy the exception is associated.
    updated_by str
    updated_time str
    constraints List<Property Map>
    Constraint. See Constraint below for details.
    description String
    The description of the policy exception.
    policyId String
    The id of the policy the exception is associated.
    updatedBy String
    updatedTime String

    Supporting Types

    PolicyExceptionConstraint, PolicyExceptionConstraintArgs

    FieldKey string
    The key of the constraint being applied. Example for Aws polices this could be accountIds.
    FieldValueMaps List<PolicyExceptionConstraintFieldValueMap>
    FieldValueMap. SeeFieldValueMap below for details.

    Deprecated: Deprecated

    FieldValues List<string>
    The values related to the constraint key.
    FieldValuesMaps List<PolicyExceptionConstraintFieldValuesMap>
    FieldValueMap. SeeFieldValuesMap below for details.
    FieldKey string
    The key of the constraint being applied. Example for Aws polices this could be accountIds.
    FieldValueMaps []PolicyExceptionConstraintFieldValueMap
    FieldValueMap. SeeFieldValueMap below for details.

    Deprecated: Deprecated

    FieldValues []string
    The values related to the constraint key.
    FieldValuesMaps []PolicyExceptionConstraintFieldValuesMap
    FieldValueMap. SeeFieldValuesMap below for details.
    fieldKey String
    The key of the constraint being applied. Example for Aws polices this could be accountIds.
    fieldValueMaps List<PolicyExceptionConstraintFieldValueMap>
    FieldValueMap. SeeFieldValueMap below for details.

    Deprecated: Deprecated

    fieldValues List<String>
    The values related to the constraint key.
    fieldValuesMaps List<PolicyExceptionConstraintFieldValuesMap>
    FieldValueMap. SeeFieldValuesMap below for details.
    fieldKey string
    The key of the constraint being applied. Example for Aws polices this could be accountIds.
    fieldValueMaps PolicyExceptionConstraintFieldValueMap[]
    FieldValueMap. SeeFieldValueMap below for details.

    Deprecated: Deprecated

    fieldValues string[]
    The values related to the constraint key.
    fieldValuesMaps PolicyExceptionConstraintFieldValuesMap[]
    FieldValueMap. SeeFieldValuesMap below for details.
    field_key str
    The key of the constraint being applied. Example for Aws polices this could be accountIds.
    field_value_maps Sequence[PolicyExceptionConstraintFieldValueMap]
    FieldValueMap. SeeFieldValueMap below for details.

    Deprecated: Deprecated

    field_values Sequence[str]
    The values related to the constraint key.
    field_values_maps Sequence[PolicyExceptionConstraintFieldValuesMap]
    FieldValueMap. SeeFieldValuesMap below for details.
    fieldKey String
    The key of the constraint being applied. Example for Aws polices this could be accountIds.
    fieldValueMaps List<Property Map>
    FieldValueMap. SeeFieldValueMap below for details.

    Deprecated: Deprecated

    fieldValues List<String>
    The values related to the constraint key.
    fieldValuesMaps List<Property Map>
    FieldValueMap. SeeFieldValuesMap below for details.

    PolicyExceptionConstraintFieldValueMap, PolicyExceptionConstraintFieldValueMapArgs

    Key string
    The values map key
    Value string
    The values map value
    Key string
    The values map key
    Value string
    The values map value
    key String
    The values map key
    value String
    The values map value
    key string
    The values map key
    value string
    The values map value
    key str
    The values map key
    value str
    The values map value
    key String
    The values map key
    value String
    The values map value

    PolicyExceptionConstraintFieldValuesMap, PolicyExceptionConstraintFieldValuesMapArgs

    Key string
    The values map key
    Values List<string>
    The values map value list
    Key string
    The values map key
    Values []string
    The values map value list
    key String
    The values map key
    values List<String>
    The values map value list
    key string
    The values map key
    values string[]
    The values map value list
    key str
    The values map key
    values Sequence[str]
    The values map value list
    key String
    The values map key
    values List<String>
    The values map value list

    Import

    A Lacework policy can be imported using a POLICY_ID and EXCEPTION_ID, e.g.

    $ pulumi import lacework:index/policyException:PolicyException example YourLQLPolicyID YourExceptionID
    

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

    Package Details

    Repository
    lacework lacework/terraform-provider-lacework
    License
    Notes
    This Pulumi package is based on the lacework Terraform Provider.
    lacework logo
    lacework 2.0.6 published on Monday, Apr 14, 2025 by lacework