-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.scan/misconfigurationIssues relating to misconfiguration scanningIssues relating to misconfiguration scanning
Milestone
Description
Discussed in #8751
Originally posted by simar7 April 17, 2025
We should also be able to parse the following:
Check for specific Policy ARNs
# Provider configuration
provider "aws" {
region = "us-west-2"
}
# Create an IAM role
resource "aws_iam_role" "example_role" {
name = "example-role"
assume_role_policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Effect = "Allow",
Principal = {
Service = "ec2.amazonaws.com"
},
Action = "sts:AssumeRole"
}
]
})
}
# Attach the AmazonS3FullAccess policy to the IAM role
resource "aws_iam_role_policy_attachment" "example_role_policy_attachment" {
role = aws_iam_role.example_role.name
policy_arn = "arn:aws:iam::aws:policy/AmazonS3FullAccess"
}Here "arn:aws:iam::aws:policy/AmazonS3FullAccess" equates to the following:
{
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Action" : [
"s3:*",
"s3-object-lambda:*"
],
"Resource" : "*"
}
]
}Check for JSON Policy docs
An example is available here https://raw.githubusercontent.com/aws-samples/aws-stepfunctions-ecs-fargate-process/d748389c6ee443389a7275f9056f712f9359b178/templates/roles.tf
Metadata
Metadata
Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.scan/misconfigurationIssues relating to misconfiguration scanningIssues relating to misconfiguration scanning
Type
Projects
Status
No status