How do you enable least-privilege access for Terragrunt?

Enabling least-privilege access for Terragrunt involves configuring IAM roles and policies in a way that restricts permissions only to what is necessary for a user or application to operate. This approach enhances security by minimizing the risk of unauthorized access and potential exploits. Here is an example of how to configure such settings:

// Example IAM policy for least-privilege access { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject" ], "Resource": "arn:aws:s3:::your-bucket-name/*" }, { "Effect": "Allow", "Action": "terraform:Apply", "Resource": "arn:aws:ec2:*:*:instance/*" }, { "Effect": "Deny", "Action": "*", "Resource": "*", "Condition": { "StringNotEquals": { "aws:userid": "your-user-id" } } } ] }

least-privilege access Terragrunt IAM roles security AWS permissions