-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a role allowing read-only access to this root module's Terraform …
…state Adding such a role also necessitates adding remote state and a provider for the Terraform account, as well as two new input variables.
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 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,25 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Create the IAM policy and role that allows read-only access to the Terraform | ||
# state for this project in the S3 bucket where Terraform remote state is | ||
# stored. | ||
# ------------------------------------------------------------------------------ | ||
|
||
module "read_terraform_state" { | ||
source = "github.com/cisagov/terraform-state-read-role-tf-module" | ||
|
||
providers = { | ||
aws = aws.terraformprovisionaccount | ||
# This provider isn't used because of the create_assume_role = | ||
# false below. | ||
aws.users = aws | ||
} | ||
|
||
account_ids = distinct(concat([ | ||
local.users_account_id | ||
], var.additional_remote_state_account_ids)) | ||
# Don't create the assume role policy | ||
create_assume_role = false | ||
role_name = var.read_terraform_state_role_name | ||
terraform_state_bucket_name = "cisa-cool-terraform-state" | ||
terraform_state_path = "cool-dns-cyber.dhs.gov/*.tfstate" | ||
} |
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