-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure folders to serperate IAM from services
- Loading branch information
Chandra Reddy
authored and
Chandra Reddy
committed
Aug 16, 2024
1 parent
e6570e9
commit 1dda6ad
Showing
10 changed files
with
479 additions
and
445 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
resource "aws_iam_role" "apprunner_role" { | ||
name = "apprunner-access-role" | ||
|
||
assume_role_policy = jsonencode({ | ||
Version = "2012-10-17", | ||
Statement = [ | ||
{ | ||
Effect = "Allow", | ||
Principal = { | ||
Service = "build.apprunner.amazonaws.com" | ||
}, | ||
Action = "sts:AssumeRole" | ||
}, | ||
] | ||
}) | ||
} | ||
|
||
|
||
resource "aws_iam_policy" "ecr_access_policy" { | ||
name = "apprunner-ecr-access-policy" | ||
|
||
policy = jsonencode({ | ||
Version = "2012-10-17", | ||
Statement = [ | ||
{ | ||
Effect = "Allow", | ||
Action = [ | ||
"ecr:GetDownloadUrlForLayer", | ||
"ecr:BatchGetImage", | ||
"ecr:BatchCheckLayerAvailability" | ||
], | ||
Resource = "*" | ||
}, | ||
{ | ||
Effect = "Allow", | ||
Action = "ecr:GetAuthorizationToken", | ||
Resource = "*" | ||
} | ||
] | ||
}) | ||
} | ||
|
||
resource "aws_iam_role_policy_attachment" "apprunner_ecr_policy_attach" { | ||
role = aws_iam_role.apprunner_role.name | ||
policy_arn = aws_iam_policy.ecr_access_policy.arn | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "5.62.0" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "us-east-1" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
variable "applications" { | ||
type = list(string) | ||
default = ["announcements"] | ||
} | ||
|
||
variable "environments" { | ||
type = list(string) | ||
default = ["dev", "qa", "prod"] | ||
} | ||
|
||
locals { | ||
app_env_combinations = [ | ||
for app in var.applications : [ | ||
for env in var.environments : { | ||
app = app | ||
env = env | ||
} | ||
] | ||
] | ||
|
||
app_env_list = flatten(local.app_env_combinations) | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"version": 4, | ||
"terraform_version": "1.7.2", | ||
"serial": 5, | ||
"lineage": "8ebc2ad4-09a6-559d-169e-e7f1af71737f", | ||
"outputs": {}, | ||
"resources": [], | ||
"check_results": null | ||
} |
Oops, something went wrong.