1. Packages
  2. AWS Classic
  3. API Docs
  4. verifiedpermissions
  5. Policy

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.36.0 published on Wednesday, May 15, 2024 by Pulumi

aws.verifiedpermissions.Policy

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.36.0 published on Wednesday, May 15, 2024 by Pulumi

    Resource for managing an AWS Verified Permissions Policy.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const test = new aws.verifiedpermissions.Policy("test", {
        policyStoreId: testAwsVerifiedpermissionsPolicyStore.id,
        definition: {
            static: {
                statement: "permit (principal, action == Action::\"view\", resource in Album:: \"test_album\");",
            },
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    test = aws.verifiedpermissions.Policy("test",
        policy_store_id=test_aws_verifiedpermissions_policy_store["id"],
        definition=aws.verifiedpermissions.PolicyDefinitionArgs(
            static=aws.verifiedpermissions.PolicyDefinitionStaticArgs(
                statement="permit (principal, action == Action::\"view\", resource in Album:: \"test_album\");",
            ),
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/verifiedpermissions"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := verifiedpermissions.NewPolicy(ctx, "test", &verifiedpermissions.PolicyArgs{
    			PolicyStoreId: pulumi.Any(testAwsVerifiedpermissionsPolicyStore.Id),
    			Definition: &verifiedpermissions.PolicyDefinitionArgs{
    				Static: &verifiedpermissions.PolicyDefinitionStaticArgs{
    					Statement: pulumi.String("permit (principal, action == Action::\"view\", resource in Album:: \"test_album\");"),
    				},
    			},
    		})
    		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 test = new Aws.VerifiedPermissions.Policy("test", new()
        {
            PolicyStoreId = testAwsVerifiedpermissionsPolicyStore.Id,
            Definition = new Aws.VerifiedPermissions.Inputs.PolicyDefinitionArgs
            {
                Static = new Aws.VerifiedPermissions.Inputs.PolicyDefinitionStaticArgs
                {
                    Statement = "permit (principal, action == Action::\"view\", resource in Album:: \"test_album\");",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.verifiedpermissions.Policy;
    import com.pulumi.aws.verifiedpermissions.PolicyArgs;
    import com.pulumi.aws.verifiedpermissions.inputs.PolicyDefinitionArgs;
    import com.pulumi.aws.verifiedpermissions.inputs.PolicyDefinitionStaticArgs;
    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 test = new Policy("test", PolicyArgs.builder()        
                .policyStoreId(testAwsVerifiedpermissionsPolicyStore.id())
                .definition(PolicyDefinitionArgs.builder()
                    .static_(PolicyDefinitionStaticArgs.builder()
                        .statement("permit (principal, action == Action::\"view\", resource in Album:: \"test_album\");")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      test:
        type: aws:verifiedpermissions:Policy
        properties:
          policyStoreId: ${testAwsVerifiedpermissionsPolicyStore.id}
          definition:
            static:
              statement: 'permit (principal, action == Action::"view", resource in Album:: "test_album");'
    

    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,
               policy_store_id: Optional[str] = None,
               definition: Optional[PolicyDefinitionArgs] = 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:verifiedpermissions:Policy
    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 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.

    Example

    The following reference example uses placeholder values for all input properties.

    var examplepolicyResourceResourceFromVerifiedpermissionspolicy = new Aws.VerifiedPermissions.Policy("examplepolicyResourceResourceFromVerifiedpermissionspolicy", new()
    {
        PolicyStoreId = "string",
        Definition = new Aws.VerifiedPermissions.Inputs.PolicyDefinitionArgs
        {
            Static = new Aws.VerifiedPermissions.Inputs.PolicyDefinitionStaticArgs
            {
                Statement = "string",
                Description = "string",
            },
            TemplateLinked = new Aws.VerifiedPermissions.Inputs.PolicyDefinitionTemplateLinkedArgs
            {
                PolicyTemplateId = "string",
                Principal = new Aws.VerifiedPermissions.Inputs.PolicyDefinitionTemplateLinkedPrincipalArgs
                {
                    EntityId = "string",
                    EntityType = "string",
                },
                Resource = new Aws.VerifiedPermissions.Inputs.PolicyDefinitionTemplateLinkedResourceArgs
                {
                    EntityId = "string",
                    EntityType = "string",
                },
            },
        },
    });
    
    example, err := verifiedpermissions.NewPolicy(ctx, "examplepolicyResourceResourceFromVerifiedpermissionspolicy", &verifiedpermissions.PolicyArgs{
    	PolicyStoreId: pulumi.String("string"),
    	Definition: &verifiedpermissions.PolicyDefinitionArgs{
    		Static: &verifiedpermissions.PolicyDefinitionStaticArgs{
    			Statement:   pulumi.String("string"),
    			Description: pulumi.String("string"),
    		},
    		TemplateLinked: &verifiedpermissions.PolicyDefinitionTemplateLinkedArgs{
    			PolicyTemplateId: pulumi.String("string"),
    			Principal: &verifiedpermissions.PolicyDefinitionTemplateLinkedPrincipalArgs{
    				EntityId:   pulumi.String("string"),
    				EntityType: pulumi.String("string"),
    			},
    			Resource: &verifiedpermissions.PolicyDefinitionTemplateLinkedResourceArgs{
    				EntityId:   pulumi.String("string"),
    				EntityType: pulumi.String("string"),
    			},
    		},
    	},
    })
    
    var examplepolicyResourceResourceFromVerifiedpermissionspolicy = new Policy("examplepolicyResourceResourceFromVerifiedpermissionspolicy", PolicyArgs.builder()        
        .policyStoreId("string")
        .definition(PolicyDefinitionArgs.builder()
            .static_(PolicyDefinitionStaticArgs.builder()
                .statement("string")
                .description("string")
                .build())
            .templateLinked(PolicyDefinitionTemplateLinkedArgs.builder()
                .policyTemplateId("string")
                .principal(PolicyDefinitionTemplateLinkedPrincipalArgs.builder()
                    .entityId("string")
                    .entityType("string")
                    .build())
                .resource(PolicyDefinitionTemplateLinkedResourceArgs.builder()
                    .entityId("string")
                    .entityType("string")
                    .build())
                .build())
            .build())
        .build());
    
    examplepolicy_resource_resource_from_verifiedpermissionspolicy = aws.verifiedpermissions.Policy("examplepolicyResourceResourceFromVerifiedpermissionspolicy",
        policy_store_id="string",
        definition=aws.verifiedpermissions.PolicyDefinitionArgs(
            static=aws.verifiedpermissions.PolicyDefinitionStaticArgs(
                statement="string",
                description="string",
            ),
            template_linked=aws.verifiedpermissions.PolicyDefinitionTemplateLinkedArgs(
                policy_template_id="string",
                principal=aws.verifiedpermissions.PolicyDefinitionTemplateLinkedPrincipalArgs(
                    entity_id="string",
                    entity_type="string",
                ),
                resource=aws.verifiedpermissions.PolicyDefinitionTemplateLinkedResourceArgs(
                    entity_id="string",
                    entity_type="string",
                ),
            ),
        ))
    
    const examplepolicyResourceResourceFromVerifiedpermissionspolicy = new aws.verifiedpermissions.Policy("examplepolicyResourceResourceFromVerifiedpermissionspolicy", {
        policyStoreId: "string",
        definition: {
            static: {
                statement: "string",
                description: "string",
            },
            templateLinked: {
                policyTemplateId: "string",
                principal: {
                    entityId: "string",
                    entityType: "string",
                },
                resource: {
                    entityId: "string",
                    entityType: "string",
                },
            },
        },
    });
    
    type: aws:verifiedpermissions:Policy
    properties:
        definition:
            static:
                description: string
                statement: string
            templateLinked:
                policyTemplateId: string
                principal:
                    entityId: string
                    entityType: string
                resource:
                    entityId: string
                    entityType: string
        policyStoreId: 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

    The Policy resource accepts the following input properties:

    PolicyStoreId string
    The Policy Store ID of the policy store.
    Definition PolicyDefinition
    The definition of the policy. See Definition below.
    PolicyStoreId string
    The Policy Store ID of the policy store.
    Definition PolicyDefinitionArgs
    The definition of the policy. See Definition below.
    policyStoreId String
    The Policy Store ID of the policy store.
    definition PolicyDefinition
    The definition of the policy. See Definition below.
    policyStoreId string
    The Policy Store ID of the policy store.
    definition PolicyDefinition
    The definition of the policy. See Definition below.
    policy_store_id str
    The Policy Store ID of the policy store.
    definition PolicyDefinitionArgs
    The definition of the policy. See Definition below.
    policyStoreId String
    The Policy Store ID of the policy store.
    definition Property Map
    The definition of the policy. See Definition below.

    Outputs

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

    CreatedDate string
    The date the policy was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyId string
    The Policy ID of the policy.
    CreatedDate string
    The date the policy was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyId string
    The Policy ID of the policy.
    createdDate String
    The date the policy was created.
    id String
    The provider-assigned unique ID for this managed resource.
    policyId String
    The Policy ID of the policy.
    createdDate string
    The date the policy was created.
    id string
    The provider-assigned unique ID for this managed resource.
    policyId string
    The Policy ID of the policy.
    created_date str
    The date the policy was created.
    id str
    The provider-assigned unique ID for this managed resource.
    policy_id str
    The Policy ID of the policy.
    createdDate String
    The date the policy was created.
    id String
    The provider-assigned unique ID for this managed resource.
    policyId String
    The Policy ID of the policy.

    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,
            created_date: Optional[str] = None,
            definition: Optional[PolicyDefinitionArgs] = None,
            policy_id: Optional[str] = None,
            policy_store_id: Optional[str] = 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)
    Resource lookup is not supported in YAML
    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:
    CreatedDate string
    The date the policy was created.
    Definition PolicyDefinition
    The definition of the policy. See Definition below.
    PolicyId string
    The Policy ID of the policy.
    PolicyStoreId string
    The Policy Store ID of the policy store.
    CreatedDate string
    The date the policy was created.
    Definition PolicyDefinitionArgs
    The definition of the policy. See Definition below.
    PolicyId string
    The Policy ID of the policy.
    PolicyStoreId string
    The Policy Store ID of the policy store.
    createdDate String
    The date the policy was created.
    definition PolicyDefinition
    The definition of the policy. See Definition below.
    policyId String
    The Policy ID of the policy.
    policyStoreId String
    The Policy Store ID of the policy store.
    createdDate string
    The date the policy was created.
    definition PolicyDefinition
    The definition of the policy. See Definition below.
    policyId string
    The Policy ID of the policy.
    policyStoreId string
    The Policy Store ID of the policy store.
    created_date str
    The date the policy was created.
    definition PolicyDefinitionArgs
    The definition of the policy. See Definition below.
    policy_id str
    The Policy ID of the policy.
    policy_store_id str
    The Policy Store ID of the policy store.
    createdDate String
    The date the policy was created.
    definition Property Map
    The definition of the policy. See Definition below.
    policyId String
    The Policy ID of the policy.
    policyStoreId String
    The Policy Store ID of the policy store.

    Supporting Types

    PolicyDefinition, PolicyDefinitionArgs

    Static PolicyDefinitionStatic
    The static policy statement. See Static below.
    TemplateLinked PolicyDefinitionTemplateLinked
    The template linked policy. See Template Linked below.
    Static PolicyDefinitionStatic
    The static policy statement. See Static below.
    TemplateLinked PolicyDefinitionTemplateLinked
    The template linked policy. See Template Linked below.
    static_ PolicyDefinitionStatic
    The static policy statement. See Static below.
    templateLinked PolicyDefinitionTemplateLinked
    The template linked policy. See Template Linked below.
    static PolicyDefinitionStatic
    The static policy statement. See Static below.
    templateLinked PolicyDefinitionTemplateLinked
    The template linked policy. See Template Linked below.
    static PolicyDefinitionStatic
    The static policy statement. See Static below.
    template_linked PolicyDefinitionTemplateLinked
    The template linked policy. See Template Linked below.
    static Property Map
    The static policy statement. See Static below.
    templateLinked Property Map
    The template linked policy. See Template Linked below.

    PolicyDefinitionStatic, PolicyDefinitionStaticArgs

    Statement string
    The statement of the static policy.
    Description string
    The description of the static policy.
    Statement string
    The statement of the static policy.
    Description string
    The description of the static policy.
    statement String
    The statement of the static policy.
    description String
    The description of the static policy.
    statement string
    The statement of the static policy.
    description string
    The description of the static policy.
    statement str
    The statement of the static policy.
    description str
    The description of the static policy.
    statement String
    The statement of the static policy.
    description String
    The description of the static policy.

    PolicyDefinitionTemplateLinked, PolicyDefinitionTemplateLinkedArgs

    PolicyTemplateId string
    The ID of the template.
    Principal PolicyDefinitionTemplateLinkedPrincipal
    The principal of the template linked policy.
    Resource PolicyDefinitionTemplateLinkedResource
    The resource of the template linked policy.
    PolicyTemplateId string
    The ID of the template.
    Principal PolicyDefinitionTemplateLinkedPrincipal
    The principal of the template linked policy.
    Resource PolicyDefinitionTemplateLinkedResource
    The resource of the template linked policy.
    policyTemplateId String
    The ID of the template.
    principal PolicyDefinitionTemplateLinkedPrincipal
    The principal of the template linked policy.
    resource PolicyDefinitionTemplateLinkedResource
    The resource of the template linked policy.
    policyTemplateId string
    The ID of the template.
    principal PolicyDefinitionTemplateLinkedPrincipal
    The principal of the template linked policy.
    resource PolicyDefinitionTemplateLinkedResource
    The resource of the template linked policy.
    policy_template_id str
    The ID of the template.
    principal PolicyDefinitionTemplateLinkedPrincipal
    The principal of the template linked policy.
    resource PolicyDefinitionTemplateLinkedResource
    The resource of the template linked policy.
    policyTemplateId String
    The ID of the template.
    principal Property Map
    The principal of the template linked policy.
    resource Property Map
    The resource of the template linked policy.

    PolicyDefinitionTemplateLinkedPrincipal, PolicyDefinitionTemplateLinkedPrincipalArgs

    EntityId string
    The entity ID of the principal.
    EntityType string
    The entity type of the principal.
    EntityId string
    The entity ID of the principal.
    EntityType string
    The entity type of the principal.
    entityId String
    The entity ID of the principal.
    entityType String
    The entity type of the principal.
    entityId string
    The entity ID of the principal.
    entityType string
    The entity type of the principal.
    entity_id str
    The entity ID of the principal.
    entity_type str
    The entity type of the principal.
    entityId String
    The entity ID of the principal.
    entityType String
    The entity type of the principal.

    PolicyDefinitionTemplateLinkedResource, PolicyDefinitionTemplateLinkedResourceArgs

    EntityId string
    The entity ID of the resource.
    EntityType string
    The entity type of the resource.
    EntityId string
    The entity ID of the resource.
    EntityType string
    The entity type of the resource.
    entityId String
    The entity ID of the resource.
    entityType String
    The entity type of the resource.
    entityId string
    The entity ID of the resource.
    entityType string
    The entity type of the resource.
    entity_id str
    The entity ID of the resource.
    entity_type str
    The entity type of the resource.
    entityId String
    The entity ID of the resource.
    entityType String
    The entity type of the resource.

    Import

    Using pulumi import, import Verified Permissions Policy using the policy_id,policy_store_id. For example:

    $ pulumi import aws:verifiedpermissions/policy:Policy example policy-id-12345678,policy-store-id-12345678
    

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.36.0 published on Wednesday, May 15, 2024 by Pulumi