AwsIamRole

Creates an AWS IAM role.

Remarks

This component wraps aws.iam.Role, resolves assume role policy templates when needed, and applies default tags.

Naming:

  • Provider child type aws:iam/role:Role 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 role name uses stackServicePurpose: ${env}-${projectHash}-${args.serviceCode}-${args.name}. args.serviceCode is selected from the controlled IAM service-code set and the camelCase purpose budget is calculated from its resolved length to remain within IAM's 64-character limit.

Example

CODE
import { iamAssumeRoleServicePrincipals, iamRoleServiceCodes } from '@jobcloud/pulumi-helpers';

const role = new AwsIamRole({
  name: 'appRole',
  serviceCode: iamRoleServiceCodes.ecs,
  assumeRolePolicy: { servicePrincipal: iamAssumeRoleServicePrincipals.ecsTasks },
  description: 'Application task role',
});

const assumeRolePolicy = new AwsIamAssumeRolePolicy({
  assumeRolePolicy: { servicePrincipal: iamAssumeRoleServicePrincipals.ecsTasks },
});

const roleFromAssumeRolePolicyHelper = new AwsIamRole({
  name: 'appRoleFromHelper',
  serviceCode: iamRoleServiceCodes.ecs,
  assumeRolePolicy,
});

Constructors

new AwsIamRole( args: AwsIamRoleResourceArgs, options?: ResourceOptions, ): AwsIamRole

Parameters

  • args (AwsIamRoleResourceArgs) — Component inputs forwarded to the underlying role resource.
  • options (ResourceOptions, optional) — Optional settings controlling resource behaviour.

Returns

AwsIamRole


Properties

arn: Output<string>

readonly

The IAM role ARN.

id: Output<string>

readonly

The provider-assigned ID for this role resource.

name: Output<string>

readonly

The IAM role name.

role: Role

readonly

The underlying AWS IAM role resource.

uniqueId: Output<string>

readonly

Stable and unique string identifying the role.