iam-role
Creates an IAM role with managed policies, inline policies, and an optional EC2 instance profile.
Provisions a single IAM role with a caller-supplied trust policy, attaches any number of AWS-managed or customer-managed policies, defines named inline policies, and optionally creates an EC2 instance profile backed by the role. Supports permissions boundaries for privilege management.
Usage
module "lambda_exec_role" {
source = "hcassc.jfrog.io/iac-terraform-modules-virtual/identity/iam-role/aws"
version = "0.1.0"
name = "my-lambda-exec"
assume_role_policy = data.aws_iam_policy_document.lambda_assume.json
managed_policy_arns = [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
]
}
Requirements
Providers
Resources
| Name |
Description |
Type |
Default |
Required |
| assume_role_policy |
JSON trust policy document for the role |
string |
n/a |
yes |
| name |
IAM role name |
string |
n/a |
yes |
| description |
IAM role description |
string |
"" |
no |
| force_detach_policies |
Force-detach policies when destroying the role |
bool |
false |
no |
| inline_policies |
Map of inline policy name to JSON policy document |
map(string) |
{} |
no |
| instance_profile |
Create an EC2 instance profile for this role |
bool |
false |
no |
| instance_profile_name |
Name for the instance profile (defaults to role name) |
string |
null |
no |
| managed_policy_arns |
List of managed policy ARNs to attach |
list(string) |
[] |
no |
| max_session_duration |
Maximum session duration in seconds (3600–43200) |
number |
3600 |
no |
| path |
IAM role path |
string |
"/" |
no |
| permissions_boundary |
ARN of the permissions boundary policy (optional) |
string |
null |
no |
| tags |
Resource tags to apply to all resources |
map(string) |
{} |
no |
Outputs