AwsIamPolicy

Creates an AWS IAM policy.

Remarks

This component wraps aws.iam.Policy and adds policy-template convenience. If args.policy is provided as a template, placeholders are resolved before resource creation. Default tags are applied using ${namespace}:project and ${namespace}:env.

Naming:

  • Provider child type aws:iam/policy:Policy uses readable tuple [args.name], producing ${env}-${projectHash}-${sanitised args.name}. As this plain helper has no component root, its args.name discriminator is sufficient for direct construction; facade construction supplies the AwsIam parent.
  • The AWS policy name uses stackAndPurpose: ${env}-${projectHash}-${args.name}. IAM allows 128 characters, so args.name is a required camelCase purpose capped at 115 characters.

Example

CODE
const policy = new AwsIamPolicy({
  name: 'appReadOnlyPolicy',
  description: 'Read only access for application role',
  policy: {
    path: './policies/app-read-only.json',
    variables: {
      bucketName: 'my-app-bucket',
    },
  },
});

Constructors

new AwsIamPolicy( args: AwsIamPolicyArgs, options?: ResourceOptions, ): AwsIamPolicy

Parameters

  • args (AwsIamPolicyArgs) — Component inputs forwarded to the underlying policy resource. policy must be provided as JSON file/template input.
  • options (ResourceOptions, optional) — Optional settings controlling resource behaviour.

Returns

AwsIamPolicy


Properties

arn: Output<string>

readonly

The IAM policy ARN.

id: Output<string>

readonly

The provider-assigned ID for this policy resource.

policy: Policy

readonly

The underlying AWS IAM policy resource.

policyDocument: Output<PolicyDocument>

readonly

The effective policy document applied to the resource.

policyId: Output<string>

readonly

The IAM policy stable ID.