-
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.
- Loading branch information
1 parent
55ddc13
commit 76ddbf7
Showing
5 changed files
with
76 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.DS_Store | ||
.DS_Store | ||
.terraform* |
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,8 @@ | ||
# terraform { | ||
# backend "s3" { | ||
# bucket = "my-terraform-state-bucket-1234" | ||
# key = "terraform.tfstate" | ||
# dynamodb_table = "terraform-s3-state-lock" | ||
# 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,29 @@ | ||
module "s3_terraform_state" { | ||
source = "michael-ortiz/s3-terraform-state/aws" | ||
version = "~> 1.0" | ||
|
||
state_bucket_names = ["my-terraform-state-bucket-1234"] // Used in backend.tf to set S3 backend | ||
state_lock_table_name = "terraform-s3-state-lock" // Used in backend.tf to set S3 backend | ||
} | ||
|
||
# Plan Role with ReadOnlyAccess - Creates OIDC Provider | ||
module "github_actions_oidc_plan" { | ||
source = "michael-ortiz/github-actions-oidc/aws" | ||
version = "~> 1.0" | ||
|
||
create_oidc_provider = true | ||
role_name = "github-actions-oidc-role-plan" | ||
repositories = ["Organization/RepositoryName"] | ||
oidc_role_policies_arns = ["arn:aws:iam::aws:policy/ReadOnlyAccess"] | ||
} | ||
|
||
# Apply Role with AdministratorAccess - Does not create OIDC Provider becase it was already created in the Plan Role | ||
module "github_actions_oidc_apply" { | ||
source = "michael-ortiz/github-actions-oidc/aws" | ||
version = "~> 1.0" | ||
|
||
create_oidc_provider = false | ||
role_name = "github-actions-oidc-role-apply" | ||
repositories = ["Organization/RepositoryName"] | ||
oidc_role_policies_arns = ["arn:aws:iam::aws:policy/AdministratorAccess"] | ||
} |
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,19 @@ | ||
output "apply_role_arn" { | ||
description = "The ARN of the role to be assumed by the apply job" | ||
value = module.github_actions_oidc_apply.oidc_role_arn | ||
} | ||
|
||
output "plan_role_arn" { | ||
description = "The ARN of the role to be assumed by the plan job" | ||
value = module.github_actions_oidc_apply.oidc_role_arn | ||
} | ||
|
||
output "state_bucket_names" { | ||
description = "The names of the S3 buckets used for Terraform state storage" | ||
value = module.s3_terraform_state.state_bucket_names | ||
} | ||
|
||
output "state_lock_table_name" { | ||
description = "The name of the DynamoDB table used for Terraform state locking" | ||
value = module.s3_terraform_state.state_lock_table_name | ||
} |