Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33308759
D8669.1768802820.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8669.1768802820.diff
View Options
diff --git a/services/terraform/remote/main.tf b/services/terraform/remote/main.tf
--- a/services/terraform/remote/main.tf
+++ b/services/terraform/remote/main.tf
@@ -1,3 +1,13 @@
+terraform {
+ backend "s3" {
+ region = "us-east-2"
+ key = "terraform.tfstate"
+ bucket = "commapp-terraform"
+ dynamodb_table = "terraform-lock"
+ encrypt = true
+ }
+}
+
provider "sops" {}
data "sops_file" "secrets_json" {
@@ -5,14 +15,20 @@
}
locals {
- secrets = jsondecode(data.sops_file.secrets_json.raw)
+ environment = terraform.workspace
+ secrets = jsondecode(data.sops_file.secrets_json.raw)
+
+ target_account_id = lookup(local.secrets.accountIDs, local.environment)
+ terraform_role_arn = "arn:aws:iam::${local.target_account_id}:role/Terraform"
}
provider "aws" {
region = "us-east-2"
- shared_config_files = ["${pathexpand("~/.aws/config")}"]
- shared_credentials_files = ["${pathexpand("~/.aws/credentials")}"]
+ assume_role {
+ role_arn = local.terraform_role_arn
+ external_id = "terraform"
+ }
# automatically add these tags to all resources
default_tags {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 6:07 AM (19 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5954737
Default Alt Text
D8669.1768802820.diff (1 KB)
Attached To
Mode
D8669: [services][terraform] Introduce S3 backend
Attached
Detach File
Event Timeline
Log In to Comment