Skip to content
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6f4e743
add legacy variable to tfstate service and create backends
juliareynolds-nava Apr 10, 2025
fa9ed38
add greenfield buckets
juliareynolds-nava Apr 14, 2025
3f6a9eb
remove dynamo table config
juliareynolds-nava Apr 14, 2025
4786972
remove dynamo table config
juliareynolds-nava Apr 14, 2025
787ec9b
remove dynamo table config
juliareynolds-nava Apr 14, 2025
ce06b3d
remove dynamo table config
juliareynolds-nava Apr 14, 2025
ac2f8d7
add use_lockfile to backend s3
juliareynolds-nava Apr 14, 2025
2ebbe71
add use_lockfile to backend s3. Upgrade to terraform 1.10 to support …
juliareynolds-nava Apr 14, 2025
ade7f0c
Upgrade to terraform 1.10 to support use_lockfile = true in tfstate/t…
juliareynolds-nava Apr 14, 2025
6e6030e
Remove mgmt env for services
juliareynolds-nava Apr 14, 2025
354264b
Remove mgmt env for services
juliareynolds-nava Apr 14, 2025
65ce333
Remove mgmt env for services
juliareynolds-nava Apr 14, 2025
2656185
Only delete dynamo table for greenfield
juliareynolds-nava Apr 15, 2025
7a64dfd
restore table for legacy
juliareynolds-nava Apr 15, 2025
40e8284
restore table for legacy mgmt
juliareynolds-nava Apr 15, 2025
a2d98e3
restore name for legacy non-prod access
juliareynolds-nava Apr 15, 2025
487a543
restore name for legacy non-prod access
juliareynolds-nava Apr 15, 2025
52b2c4d
revert legacy backend files
juliareynolds-nava Apr 15, 2025
5d581ce
legacy access logs
juliareynolds-nava Apr 15, 2025
dc9edc5
use lockfile for gf
juliareynolds-nava Apr 15, 2025
acce017
Revert "PLT-917: Changing runner machine type to m6a.xlarge for bette…
juliareynolds-nava Apr 15, 2025
db6903f
revert
juliareynolds-nava Apr 15, 2025
63f2af3
revert
juliareynolds-nava Apr 15, 2025
10d0b38
revert
juliareynolds-nava Apr 15, 2025
5c19de8
upgrade to tf 1.10.5
juliareynolds-nava Apr 15, 2025
0e22aa0
tf fmt
juliareynolds-nava Apr 15, 2025
596cd99
restore mgmt env
juliareynolds-nava Apr 15, 2025
0831711
legacy bucket name
juliareynolds-nava Apr 15, 2025
09e8c64
revert
juliareynolds-nava Apr 15, 2025
9a2cfbb
revert
juliareynolds-nava Apr 15, 2025
843d1fe
conditionally build dynamodb state table
juliareynolds-nava Apr 15, 2025
2296799
PLT-800: Update WAF README.md (#210)
gfreeman-navapbc Apr 10, 2025
37c885f
rollback
juliareynolds-nava Apr 15, 2025
d1d34ee
rollback
juliareynolds-nava Apr 15, 2025
5b85feb
pr feedback
juliareynolds-nava Apr 15, 2025
fbedc4a
pr feedback
juliareynolds-nava Apr 15, 2025
bf62750
update sbx to sandbox
juliareynolds-nava Apr 16, 2025
56cf0c7
update sbx to sandbox
juliareynolds-nava Apr 16, 2025
4e8ee0c
Revert "update sbx to sandbox"
juliareynolds-nava Apr 16, 2025
09f23c7
Drop changes that should not be in this PR
gsf Apr 16, 2025
2dd016a
Fix newline at end of file
gsf Apr 16, 2025
93db60c
Merge branch 'main' into jreynolds_plt_890_bucket_changes
gsf Apr 16, 2025
87b3761
Add sandbox env as an option for tfstate
gsf Apr 16, 2025
f839348
added "sandbox" to environment options for services and modules.
juliareynolds-nava Apr 16, 2025
933835b
correct terraform format
juliareynolds-nava Apr 16, 2025
e0b88e2
correct terraform format
juliareynolds-nava Apr 16, 2025
729b8f5
add mgmt for legacy backends
juliareynolds-nava Apr 16, 2025
c55e86d
tf fmt
juliareynolds-nava Apr 16, 2025
5be22e1
creating sandbox backends in non-prod
juliareynolds-nava Apr 16, 2025
417ce68
revert
juliareynolds-nava Apr 16, 2025
efd2d82
Revert "added "sandbox" to environment options for services and modul…
juliareynolds-nava Apr 16, 2025
7fb6293
Format gf backends
gsf Apr 16, 2025
11a3b4f
created prod backends
juliareynolds-nava Apr 16, 2025
f7b6c26
created prod backends
juliareynolds-nava Apr 16, 2025
79ed1c6
move dynamodb table
juliareynolds-nava Apr 16, 2025
641930e
update ab2d dev
juliareynolds-nava Apr 17, 2025
afc5a72
Fix references in bucket module
gsf Apr 17, 2025
87af94c
Drop extra comment hash
gsf Apr 17, 2025
4118497
Fix ordering in variable error message
gsf Apr 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion terraform/.terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.5
1.10.5
2 changes: 2 additions & 0 deletions terraform/backends/ab2d-dev-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "ab2d-dev-tfstate-20250409213758051700000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/ab2d-prod-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "ab2d-prod-tfstate-20250411202936776600000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/ab2d-sandbox-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "ab2d-sandbox-tfstate-20250416200059224300000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/ab2d-test-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "ab2d-test-tfstate-20250410134820763500000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/bcda-dev-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "bcda-dev-tfstate-20250409202710600700000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/bcda-prod-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "bcda-prod-tfstate-20250411203841436200000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/bcda-sandbox-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "bcda-sandbox-tfstate-20250416201512973800000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/bcda-test-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "bcda-test-tfstate-20250409171646342600000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/cdap-mgmt-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "cdap-mgmt-tfstate-20250416203557378600000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/dpc-dev-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "dpc-dev-tfstate-20250409165915907400000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/dpc-prod-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "dpc-prod-tfstate-20250411204900543700000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/dpc-sandbox-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "dpc-sandbox-tfstate-20250416202240532700000001"
use_lockfile = true
2 changes: 2 additions & 0 deletions terraform/backends/dpc-test-gf.s3.tfbackend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bucket = "dpc-test-tfstate-20250410145524530000000001"
use_lockfile = true
14 changes: 10 additions & 4 deletions terraform/modules/bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "bucket_key" {

resource "aws_s3_bucket" "this" {
bucket = var.legacy == true ? var.name : null
bucket_prefix = var.legacy == false ? var.name : null
bucket_prefix = var.legacy == false ? "${var.name}-" : null
force_destroy = true
}

Expand Down Expand Up @@ -88,12 +88,18 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "this" {
}
}
}

data "aws_iam_account_alias" "current" {}

data "aws_s3_bucket" "bucket_access_logs" {
bucket = "${data.aws_caller_identity.current.account_id}-bucket-access-logs"
bucket = (var.legacy == true ? "${data.aws_caller_identity.current.account_id}-bucket-access-logs" :
data.aws_iam_account_alias.current.account_alias == "aws-cms-oeda-bcda-prod" ? "bucket-access-logs-20250411172631068600000001" :
"bucket-access-logs-20250409172631068600000001")
}

resource "aws_s3_bucket_logging" "this" {
bucket = aws_s3_bucket.this.id
bucket = aws_s3_bucket.this.bucket

target_bucket = data.aws_s3_bucket.bucket_access_logs.id
target_bucket = data.aws_s3_bucket.bucket_access_logs.bucket
target_prefix = "${var.name}/"
}
1 change: 0 additions & 1 deletion terraform/modules/bucket/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ terraform {
source = "hashicorp/aws"
}
}
required_version = "~> 1.5.5"
}
1 change: 0 additions & 1 deletion terraform/modules/function/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ terraform {
version = "~> 5.8.0"
}
}
required_version = "~> 1.5.5"
}
1 change: 0 additions & 1 deletion terraform/modules/queue/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ terraform {
version = "~> 5.8.0"
}
}
required_version = "~> 1.5.5"
}
3 changes: 2 additions & 1 deletion terraform/services/bucket-access-logs/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
data "aws_caller_identity" "current" {}

resource "aws_s3_bucket" "bucket_access_logs" {
bucket = "${data.aws_caller_identity.current.account_id}-bucket-access-logs"
bucket = var.legacy == true ? "${data.aws_caller_identity.current.account_id}-bucket-access-logs" : null
bucket_prefix = var.legacy == false ? "bucket-access-logs-" : null
force_destroy = true
}

Expand Down
5 changes: 5 additions & 0 deletions terraform/services/bucket-access-logs/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "legacy" {
description = "Is this deployment in the greenfield environment (false)?"
type = bool
default = true
}

This file was deleted.

1 change: 0 additions & 1 deletion terraform/services/github-actions-runner/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ terraform {
backend "s3" {
key = "github-actions/terraform.tfstate"
}
required_version = "~> 1.5.5"
}
24 changes: 0 additions & 24 deletions terraform/services/tfstate/.terraform.lock.hcl

This file was deleted.

2 changes: 1 addition & 1 deletion terraform/services/tfstate/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Terraform for initializing tfstate resources

This terraform creates the S3 buckets and DynamoDB table for storing terraform state in AWS.
This terraform creates the S3 buckets for storing terraform state in AWS.

To create the resources with the first run of `terraform init`, comment out the backend block in terraform.tf. This will create a local terraform.tfstate file.

Expand Down
1 change: 1 addition & 0 deletions terraform/services/tfstate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ module "tfstate_bucket" {
module "tfstate_table" {
source = "../../modules/table"
name = local.name
count = var.legacy == true ? 1 : 0
}
9 changes: 0 additions & 9 deletions terraform/services/tfstate/outputs.tf

This file was deleted.

2 changes: 1 addition & 1 deletion terraform/services/tfstate/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ provider "aws" {
}

terraform {
# Comment out backend block and init without -backend-config for initial creation of resources
# # Comment out backend block and init without -backend-config for initial creation of resources
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# # Comment out backend block and init without -backend-config for initial creation of resources
# Comment out backend block and init without -backend-config for initial creation of resources

backend "s3" {
key = "tfstate/terraform.tfstate"
}
Expand Down
12 changes: 6 additions & 6 deletions terraform/services/tfstate/variables.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
variable "app" {
description = "The application name (ab2d, bcda, dpc)"
description = "The application name (ab2d, bcda, dpc, cdap)"
type = string
validation {
condition = contains(["ab2d", "bcda", "dpc"], var.app)
error_message = "Valid value for app is ab2d, bcda, or dpc."
condition = contains(["ab2d", "bcda", "dpc", "cdap"], var.app)
error_message = "Valid value for app is ab2d, bcda, dpc, or cdap."
}
}

variable "env" {
description = "The application environment (dev, test, sbx, prod, mgmt)"
description = "The application environment (dev, test, sbx, sandbox, prod, mgmt)"
type = string
validation {
condition = contains(["dev", "test", "sbx", "prod", "mgmt"], var.env)
error_message = "Valid value for env is dev, test, sbx, prod, or mgmt."
condition = contains(["dev", "test", "sbx", "sandbox", "prod", "mgmt"], var.env)
error_message = "Valid value for env is dev, test, sbx, sandbox, mgmt, or prod."
}
}

Expand Down