Skip to content

Instantly share code, notes, and snippets.

@migara
Last active October 13, 2023 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save migara/a943535ef4f9b542ad18e3ed0b8d5d19 to your computer and use it in GitHub Desktop.
Save migara/a943535ef4f9b542ad18e3ed0b8d5d19 to your computer and use it in GitHub Desktop.
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"
}
}
@ahuseby
Copy link

ahuseby commented Oct 13, 2023

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")?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment