Skip to content

Commit

Permalink
Aws service accounts (#12)
Browse files Browse the repository at this point in the history
* adding a workspace for managing service accounts

* Autoformatting TF Code

* fixing module source

* adding service-accounts for use with github actions
  • Loading branch information
arnol377 committed Aug 20, 2024
1 parent a5baded commit 00768a1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
1 change: 1 addition & 0 deletions data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data "aws_region" "current" {}
27 changes: 27 additions & 0 deletions iam_policy/session_configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"Statement": [
{
"Action": "s3:*",
"Effect": "Allow",
"Resource": [
"arn:aws-us-gov:s3:::inf-test-08230846-acc4-7788-94df-5730ed20c008/*"
]
},
{
"Action": "ssm:*",
"Effect": "Allow",
"Resource": "*"
},
{
"Action": "secretsmanager:*",
"Effect": "Allow",
"Resource": "*"
},
{
"Action": "dynamodb:*",
"Effect": "Allow",
"Resource": "arn:aws-us-gov:dynamodb:us-gov-west-1:229685449397:table/tf_remote_state"
}
],
"Version": "2012-10-17"
}
1 change: 0 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,3 @@ module "ghe_runners" {
enforce_prs = false
collaborators = local.collaborators
}

18 changes: 17 additions & 1 deletion morpheus.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ module "morpheus_repos" {
enforce_prs = true
collaborators = { gomez385 = "admin", arnol377 = "admin" }
pull_request_bypassers = local.pull_request_bypassers
vars = [
{
name = "aws_access_key_id",
value = module.aws_session_configuration.iam_credentials.iam_access_key_id
},
{
name = "aws_default_region",
value = data.aws_region.current.name
}
]
secrets = [
{
name = "aws_secret_access_key"
value = module.aws_session_configuration.iam_credentials.iam_secret_access_key
}
]
managed_extra_files = [
{
path = ".github/workflows/terraform-plan.yaml"
Expand All @@ -47,4 +63,4 @@ module "morpheus_repos" {
)
}
]
}
}
5 changes: 5 additions & 0 deletions service-accounts.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module "aws_session_configuration" {
source = "HappyPathway/service-account/aws"
iam_policy = file("${path.root}/iam_policy/session_configuration.json")
iam_user_name = "github-actions-s3_upload"
}

0 comments on commit 00768a1

Please sign in to comment.