Last active
October 13, 2023 12:12
-
-
Save migara/a943535ef4f9b542ad18e3ed0b8d5d19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_role" "ngfw_role" { | |
name = "CloudNGFWRole" | |
inline_policy { | |
name = "apigateway_policy" | |
policy = jsonencode({ | |
"Version" : "2012-10-17", | |
"Statement" : [ | |
{ | |
"Effect" : "Allow", | |
"Action" : [ | |
"execute-api:Invoke", | |
"execute-api:ManageConnections" | |
], | |
"Resource" : "arn:aws:execute-api:*:*:*" | |
} | |
] | |
}) | |
} | |
assume_role_policy = jsonencode({ | |
"Version" : "2012-10-17", | |
"Statement" : [ | |
{ | |
"Sid" : "", | |
"Effect" : "Allow", | |
"Principal" : { | |
"Service" : "apigateway.amazonaws.com" | |
}, | |
"Action" : "sts:AssumeRole" | |
}, | |
{ | |
"Sid" : "", | |
"Effect" : "Allow", | |
"Principal" : { | |
"AWS" : [ | |
<your assume role ARN> | |
] | |
}, | |
"Action" : "sts:AssumeRole" | |
} | |
] | |
}) | |
tags = { | |
CloudNGFWRulestackAdmin = "Yes" | |
CloudNGFWFirewallAdmin = "Yes" | |
CloudNGFWGlobalRulestackAdmin = "Yes" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, @migara Thanks for providing an example of this setup in Terraform.
I am just wondering what the
<your assume role ARN>
is exactly. Is it supposed to be the AWS IAM Principal that the AWS provider uses? Is this statement crucial for this to work or is the first one the most important ("Service" : "apigateway.amazonaws.com"
)?