1. Packages
  2. AWS
  3. API Docs
  4. verifiedpermissions
  5. Policy
AWS v6.74.0 published on Wednesday, Mar 26, 2025 by Pulumi

aws.verifiedpermissions.Policy

Explore with Pulumi AI

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\");",
        },
    },
});
Copy
import pulumi
import pulumi_aws as aws

test = aws.verifiedpermissions.Policy("test",
    policy_store_id=test_aws_verifiedpermissions_policy_store["id"],
    definition={
        "static": {
            "statement": "permit (principal, action == Action::\"view\", resource in Album:: \"test_album\");",
        },
    })
Copy
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
	})
}
Copy
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\");",
            },
        },
    });

});
Copy
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());

    }
}
Copy
resources:
  test:
    type: aws:verifiedpermissions:Policy
    properties:
      policyStoreId: ${testAwsVerifiedpermissionsPolicyStore.id}
      definition:
        static:
          statement: 'permit (principal, action == Action::"view", resource in Album:: "test_album");'
Copy

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 This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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 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",
            },
        },
    },
});
Copy
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"),
			},
		},
	},
})
Copy
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());
Copy
examplepolicy_resource_resource_from_verifiedpermissionspolicy = aws.verifiedpermissions.Policy("examplepolicyResourceResourceFromVerifiedpermissionspolicy",
    policy_store_id="string",
    definition={
        "static": {
            "statement": "string",
            "description": "string",
        },
        "template_linked": {
            "policy_template_id": "string",
            "principal": {
                "entity_id": "string",
                "entity_type": "string",
            },
            "resource": {
                "entity_id": "string",
                "entity_type": "string",
            },
        },
    })
Copy
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",
            },
        },
    },
});
Copy
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
Copy

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:

PolicyStoreId This property is required. string
The Policy Store ID of the policy store.
Definition PolicyDefinition
The definition of the policy. See Definition below.
PolicyStoreId This property is required. string
The Policy Store ID of the policy store.
Definition PolicyDefinitionArgs
The definition of the policy. See Definition below.
policyStoreId This property is required. String
The Policy Store ID of the policy store.
definition PolicyDefinition
The definition of the policy. See Definition below.
policyStoreId This property is required. string
The Policy Store ID of the policy store.
definition PolicyDefinition
The definition of the policy. See Definition below.
policy_store_id This property is required. str
The Policy Store ID of the policy store.
definition PolicyDefinitionArgs
The definition of the policy. See Definition below.
policyStoreId This property is required. 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)
resources:  _:    type: aws:verifiedpermissions:Policy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required. string
The statement of the static policy.
Description string
The description of the static policy.
Statement This property is required. string
The statement of the static policy.
Description string
The description of the static policy.
statement This property is required. String
The statement of the static policy.
description String
The description of the static policy.
statement This property is required. string
The statement of the static policy.
description string
The description of the static policy.
statement This property is required. str
The statement of the static policy.
description str
The description of the static policy.
statement This property is required. String
The statement of the static policy.
description String
The description of the static policy.

PolicyDefinitionTemplateLinked
, PolicyDefinitionTemplateLinkedArgs

PolicyTemplateId This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. string
The entity ID of the principal.
EntityType This property is required. string
The entity type of the principal.
EntityId This property is required. string
The entity ID of the principal.
EntityType This property is required. string
The entity type of the principal.
entityId This property is required. String
The entity ID of the principal.
entityType This property is required. String
The entity type of the principal.
entityId This property is required. string
The entity ID of the principal.
entityType This property is required. string
The entity type of the principal.
entity_id This property is required. str
The entity ID of the principal.
entity_type This property is required. str
The entity type of the principal.
entityId This property is required. String
The entity ID of the principal.
entityType This property is required. String
The entity type of the principal.

PolicyDefinitionTemplateLinkedResource
, PolicyDefinitionTemplateLinkedResourceArgs

EntityId This property is required. string
The entity ID of the resource.
EntityType This property is required. string
The entity type of the resource.
EntityId This property is required. string
The entity ID of the resource.
EntityType This property is required. string
The entity type of the resource.
entityId This property is required. String
The entity ID of the resource.
entityType This property is required. String
The entity type of the resource.
entityId This property is required. string
The entity ID of the resource.
entityType This property is required. string
The entity type of the resource.
entity_id This property is required. str
The entity ID of the resource.
entity_type This property is required. str
The entity type of the resource.
entityId This property is required. String
The entity ID of the resource.
entityType This property is required. 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
Copy

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.