Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IaC and CI/CD workflows (issue #7) #26

Merged
merged 58 commits into from
Dec 6, 2023
Merged

Conversation

TylerHendrickson
Copy link
Member

@TylerHendrickson TylerHendrickson commented Dec 1, 2023

Ticket #7

Description

This PR defines the Terraform infrastructure-as-code (IaC) that can provision an AWS hosting environment (initially in Staging) for the cpf-reporter app. Additionally, it provides CI/CD workflows that automate various acceptance requirements for pull requests and deploy changes pushed to main to our Staging environment.

Along with the changes directly in scope of the related ticket, this PR includes the following changes in support of the main focus:

  • Documentation, including standard/conventional files (e.g. CODE_OF_CONDUCT.md) as well as contributor assets
  • Repository configuration files such as CODEOWNERS, .gitignore, and .gitattributes rules
  • Recommended files for facilitating yarn consistency across development and build environments
  • VSCode recommended defaults
  • Unit test runner (jest) configuration
  • Docker-related files which support development environments (and potentially others)

Finally, this PR includes changes originating from the as/second-commit branch, which is the original base for 7-deployment-infra, most of which are focused on bootstrapping the RedwoodJS framework in this repo.

Terraform changes

The Terraform project added (under the terraform/ directory) helps provision the following primary aspects of this service:

  • A CDN (CloudFront distribution) used to serve the web side of the RedwoodJS app from an S3 bucket that houses the static build artifacts (terraform/web.tf)
  • An AWS Lambda function that runs the RedwoodJS GraphQL server used to handle and respond to API requests, which is invoked from an API Gateway proxy (terraform/functions.tf and terraform/api_gateway.tf)
  • A Postgres 15 database cluster managed in RDS Aurora (terraform/postgres.tf)

Note that the usage of AWS Lambda in this service is something of an experiment. Although we use Lambda functions extensively in the grants-ingest service, using Lambda for handling API traffic, while not uncommon in its own right, is a new pattern for our team. Our most natural alternative (which is not necessarily mutually exclusive) to AWS Lambda is deploying Docker containers built from API-side code to tasks in an ECS Fargate cluster, similar to https://github.com/usdigitalresponse/usdr-gost. The current hope is that deploying Lambda functions will help simplify the infrastructure requirements for the API side of the cpf-reporter service, and serve as a starting point for running background/deferred jobs that have not yet been developed. A future pull request may contribute additional IaC that support deployment to ECS Fargate.

Copy link

github-actions bot commented Dec 1, 2023

Terraform Summary

Step Result
🖌 Terraform Format & Style
⚙️ Terraform Initialization
🤖 Terraform Validation
📖 Terraform Plan

Hint: If "Terraform Format & Style" failed, run terraform fmt -recursive from the terraform/ directory and commit the results.

Output

Validation Output
Success! The configuration is valid.


Plan Output
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+   create
 <= read (data resources)

Terraform will perform the following actions:

  # aws_cloudfront_origin_access_identity.default will be created
+   resource "aws_cloudfront_origin_access_identity" "default" {
+       caller_reference                = (known after apply)
+       cloudfront_access_identity_path = (known after apply)
+       comment                         = "CPF Reporter website access."
+       etag                            = (known after apply)
+       iam_arn                         = (known after apply)
+       id                              = (known after apply)
+       s3_canonical_user_id            = (known after apply)
    }

  # aws_cloudwatch_log_group.api_gateway will be created
+   resource "aws_cloudwatch_log_group" "api_gateway" {
+       arn               = (known after apply)
+       id                = (known after apply)
+       name              = (known after apply)
+       name_prefix       = "cpfreporter-apigateway-"
+       retention_in_days = 14
+       skip_destroy      = false
+       tags_all          = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
    }

  # aws_db_parameter_group.postgres15 will be created
+   resource "aws_db_parameter_group" "postgres15" {
+       arn         = (known after apply)
+       description = "RDS Aurora database instance parameter group for cpfreporter cluster members."
+       family      = "aurora-postgresql15"
+       id          = (known after apply)
+       name        = "cpfreporter-aurora-postgres15-db"
+       name_prefix = (known after apply)
+       tags_all    = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
    }

  # aws_rds_cluster_parameter_group.postgres15 will be created
+   resource "aws_rds_cluster_parameter_group" "postgres15" {
+       arn         = (known after apply)
+       description = "RDS Aurora cluster parameter group for cpfreporter."
+       family      = "aurora-postgresql15"
+       id          = (known after apply)
+       name        = "cpfreporter-aurora-postgres15-cluster"
+       name_prefix = (known after apply)
+       tags_all    = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }

+       parameter {
+           apply_method = "immediate"
+           name         = "log_min_duration_statement"
+           value        = "1"
        }
+       parameter {
+           apply_method = "immediate"
+           name         = "log_statement"
+           value        = "all"
        }
    }

  # aws_route53_record.apigateway_alias will be created
+   resource "aws_route53_record" "apigateway_alias" {
+       allow_overwrite = (known after apply)
+       fqdn            = (known after apply)
+       id              = (known after apply)
+       name            = "api.staging.cpf.usdr.dev"
+       type            = "A"
+       zone_id         = (sensitive value)

+       alias {
+           evaluate_target_health = false
+           name                   = (known after apply)
+           zone_id                = (known after apply)
        }
    }

  # aws_route53_record.cdn_alias will be created
+   resource "aws_route53_record" "cdn_alias" {
+       allow_overwrite = (known after apply)
+       fqdn            = (known after apply)
+       id              = (known after apply)
+       name            = "staging.cpf.usdr.dev"
+       type            = "A"
+       zone_id         = (sensitive value)

+       alias {
+           evaluate_target_health = false
+           name                   = (known after apply)
+           zone_id                = (known after apply)
        }
    }

  # aws_s3_object.lambda_artifact-graphql will be created
+   resource "aws_s3_object" "lambda_artifact-graphql" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "d0afb25c8c5f51eb4e1652810766b095"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "graphql.d0afb25c8c5f51eb4e1652810766b095.zip"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/api/dist/zipballs/graphql.zip"
+       source_hash            = "d0afb25c8c5f51eb4e1652810766b095"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["200.html"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "2698dcdf1a9a0d4f59b523c9a7c33676"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/200.html"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/200.html"
+       source_hash            = "2698dcdf1a9a0d4f59b523c9a7c33676"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["build-manifest.json"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "a9421488257208cd68a531e1304ceb4a"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/build-manifest.json"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/build-manifest.json"
+       source_hash            = "a9421488257208cd68a531e1304ceb4a"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["chunk-references.json"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "9807aa251e340e3636540f3bb27ed6d3"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/chunk-references.json"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/chunk-references.json"
+       source_hash            = "9807aa251e340e3636540f3bb27ed6d3"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["favicon.png"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "1ec96c13d372d5837aad6398f102a991"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/favicon.png"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/favicon.png"
+       source_hash            = "1ec96c13d372d5837aad6398f102a991"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["index.html"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "2698dcdf1a9a0d4f59b523c9a7c33676"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/index.html"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/index.html"
+       source_hash            = "2698dcdf1a9a0d4f59b523c9a7c33676"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["robots.txt"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "b6216d61c03e6ce0c9aea6ca7808f7ca"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/robots.txt"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/robots.txt"
+       source_hash            = "b6216d61c03e6ce0c9aea6ca7808f7ca"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["static/css/app.17717d38.css"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "cd11bf1bce2efdd3874b5dedd7d5d148"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/css/app.17717d38.css"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/css/app.17717d38.css"
+       source_hash            = "cd11bf1bce2efdd3874b5dedd7d5d148"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["static/js/NotFoundPage.fd8a8c88.chunk.js"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "1ef521486ca51b0f284d0ac24818468c"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/NotFoundPage.fd8a8c88.chunk.js"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/NotFoundPage.fd8a8c88.chunk.js"
+       source_hash            = "1ef521486ca51b0f284d0ac24818468c"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["static/js/NotFoundPage.fd8a8c88.chunk.js.LICENSE.txt"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "1c39b8752b85c13c97354951682cd8a0"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/NotFoundPage.fd8a8c88.chunk.js.LICENSE.txt"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/NotFoundPage.fd8a8c88.chunk.js.LICENSE.txt"
+       source_hash            = "1c39b8752b85c13c97354951682cd8a0"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["static/js/app.1d097a71.js"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "2a235e359549cba4ca5662988b05200d"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/app.1d097a71.js"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/app.1d097a71.js"
+       source_hash            = "2a235e359549cba4ca5662988b05200d"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["static/js/app.1d097a71.js.LICENSE.txt"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "bfc7c93462ed682180265c57b0e6fd21"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/app.1d097a71.js.LICENSE.txt"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/app.1d097a71.js.LICENSE.txt"
+       source_hash            = "bfc7c93462ed682180265c57b0e6fd21"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.origin_dist_artifact["static/js/runtime-app.c4894ab1.js"] will be created
+   resource "aws_s3_object" "origin_dist_artifact" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content_type           = (known after apply)
+       etag                   = "488c9fd785036c47d8750ba796f4af5b"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/runtime-app.c4894ab1.js"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source                 = "/home/runner/work/cpf-reporter/cpf-reporter/web/dist/static/js/runtime-app.c4894ab1.js"
+       source_hash            = "488c9fd785036c47d8750ba796f4af5b"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_s3_object.website_deploy_config will be created
+   resource "aws_s3_object" "website_deploy_config" {
+       acl                    = (known after apply)
+       bucket                 = (known after apply)
+       bucket_key_enabled     = (known after apply)
+       checksum_crc32         = (known after apply)
+       checksum_crc32c        = (known after apply)
+       checksum_sha1          = (known after apply)
+       checksum_sha256        = (known after apply)
+       content                = <<-EOT
            window.APP_CONFIG = window.APP_CONFIG || {};
            window.APP_CONFIG.featureFlags = {};
            
            window.APP_CONFIG.overrideFeatureFlag = (flagName, overrideValue) => {
              const storageKey = 'featureFlags';
              let overrides = {};
              try {
                overrides = JSON.parse(window.sessionStorage.getItem(storageKey)) || {};
              } catch (e) {
                console.error(`Error parsing window.sessionStorage.${storageKey} as JSON:`, e);
                console.warn(`window.sessionStorage.${storageKey} will be replaced.`);
              }
              overrides[flagName] = overrideValue;
              window.sessionStorage.setItem(storageKey, JSON.stringify(overrides));
              console.log('New feature flag overrides in page session:',
                window.sessionStorage.getItem(storageKey));
            };
        EOT
+       content_type           = (known after apply)
+       etag                   = "6a2b5f953f0eca8b039a6dc70aba172f"
+       force_destroy          = false
+       id                     = (known after apply)
+       key                    = "config/deploy-config.js"
+       kms_key_id             = (known after apply)
+       server_side_encryption = "AES256"
+       source_hash            = "6a2b5f953f0eca8b039a6dc70aba172f"
+       storage_class          = (known after apply)
+       tags_all               = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       version_id             = (known after apply)
    }

  # aws_ssm_parameter.postgres_master_password will be created
+   resource "aws_ssm_parameter" "postgres_master_password" {
+       arn            = (known after apply)
+       data_type      = (known after apply)
+       description    = "Master password generated when creating the Postgres cluster"
+       id             = (known after apply)
+       insecure_value = (known after apply)
+       key_id         = "arn:aws:kms:us-west-2:357150818708:key/df1661b4-62e5-4668-8e39-f872c9acfceb"
+       name           = "/cpfreporter/postgres/master_password"
+       tags_all       = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       tier           = (known after apply)
+       type           = "SecureString"
+       value          = (sensitive value)
+       version        = (known after apply)
    }

  # datadog_monitor.example_replace_me_with_something_useful[0] will be created
+   resource "datadog_monitor" "example_replace_me_with_something_useful" {
+       enable_samples      = (known after apply)
+       evaluation_delay    = 900
+       id                  = (known after apply)
+       include_tags        = true
+       message             = <<-EOT
            {{#is_alert}}
            Alert: Here is a brief description regarding the nature of the problem.
            It may be useful to indicate follow-up actions (e.g. something should be re-run) also.
            Anything about whether/when a monitor will auto-resolve is also appreciated.
            {{/is_alert}}
            {{#is_recovery}}
            Recovery: Explain why the problem is considered resolved (e.g. gremlins are now dry).
            {{/is_recovery}}
            Notify:
        EOT
+       name                = "CPF Reporter (Draft - staging): A specific problem was detected"
+       new_host_delay      = 300
+       notify_no_data      = false
+       query               = "min(last_1h):avg:aws.sqs.approximate_number_of_messages_visible{env:staging,queuename:TheSQSQueueName} > 0"
+       require_full_window = true
+       tags                = [
+           "env:staging",
+           "service:cpf-reporter",
+           "team:grants",
        ]
+       type                = "metric alert"
    }

  # random_password.postgres_user will be created
+   resource "random_password" "postgres_user" {
+       bcrypt_hash = (sensitive value)
+       id          = (known after apply)
+       length      = 32
+       lower       = true
+       min_lower   = 0
+       min_numeric = 0
+       min_special = 0
+       min_upper   = 0
+       number      = true
+       numeric     = true
+       result      = (sensitive value)
+       special     = false
+       upper       = true
    }

  # module.api_gateway.aws_apigatewayv2_api.this[0] will be created
+   resource "aws_apigatewayv2_api" "this" {
+       api_endpoint                 = (known after apply)
+       api_key_selection_expression = "$request.header.x-api-key"
+       arn                          = (known after apply)
+       description                  = "API Gateway to CPF Reporter web services"
+       disable_execute_api_endpoint = false
+       execution_arn                = (known after apply)
+       id                           = (known after apply)
+       name                         = "cpfreporter"
+       protocol_type                = "HTTP"
+       route_selection_expression   = "$request.method $request.path"
+       tags_all                     = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }

+       cors_configuration {
+           allow_credentials = true
+           allow_headers     = [
+               "authorization",
+               "content-type",
+               "x-amz-date",
+               "x-amz-security-token",
+               "x-amz-user-agent",
+               "x-api-key",
            ]
+           allow_methods     = [
+               "DELETE",
+               "GET",
+               "HEAD",
+               "OPTIONS",
+               "PATCH",
+               "POST",
+               "PUT",
            ]
+           allow_origins     = [
+               "http://staging.cpf.usdr.dev",
+               "https://api.staging.cpf.usdr.dev",
            ]
+           max_age           = 86400
        }
    }

  # module.api_gateway.aws_apigatewayv2_api_mapping.this[0] will be created
+   resource "aws_apigatewayv2_api_mapping" "this" {
+       api_id      = (known after apply)
+       domain_name = (known after apply)
+       id          = (known after apply)
+       stage       = (known after apply)
    }

  # module.api_gateway.aws_apigatewayv2_domain_name.this[0] will be created
+   resource "aws_apigatewayv2_domain_name" "this" {
+       api_mapping_selection_expression = (known after apply)
+       arn                              = (known after apply)
+       domain_name                      = "api.staging.cpf.usdr.dev"
+       id                               = (known after apply)
+       tags_all                         = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }

+       domain_name_configuration {
+           certificate_arn                        = (known after apply)
+           endpoint_type                          = "REGIONAL"
+           hosted_zone_id                         = (known after apply)
+           ownership_verification_certificate_arn = (known after apply)
+           security_policy                        = "TLS_1_2"
+           target_domain_name                     = (known after apply)
        }
    }

  # module.api_gateway.aws_apigatewayv2_integration.this["GET /graphql"] will be created
+   resource "aws_apigatewayv2_integration" "this" {
+       api_id                                    = (known after apply)
+       connection_type                           = "VPC_LINK"
+       id                                        = (known after apply)
+       integration_method                        = "POST"
+       integration_response_selection_expression = (known after apply)
+       integration_type                          = (known after apply)
+       integration_uri                           = (known after apply)
+       payload_format_version                    = "1.0"
+       timeout_milliseconds                      = (known after apply)
    }

  # module.api_gateway.aws_apigatewayv2_integration.this["POST /graphql"] will be created
+   resource "aws_apigatewayv2_integration" "this" {
+       api_id                                    = (known after apply)
+       connection_type                           = "VPC_LINK"
+       id                                        = (known after apply)
+       integration_method                        = "POST"
+       integration_response_selection_expression = (known after apply)
+       integration_type                          = (known after apply)
+       integration_uri                           = (known after apply)
+       payload_format_version                    = "1.0"
+       timeout_milliseconds                      = (known after apply)
    }

  # module.api_gateway.aws_apigatewayv2_route.this["GET /graphql"] will be created
+   resource "aws_apigatewayv2_route" "this" {
+       api_id             = (known after apply)
+       api_key_required   = false
+       authorization_type = "NONE"
+       id                 = (known after apply)
+       route_key          = "GET /graphql"
+       target             = (known after apply)
    }

  # module.api_gateway.aws_apigatewayv2_route.this["POST /graphql"] will be created
+   resource "aws_apigatewayv2_route" "this" {
+       api_id             = (known after apply)
+       api_key_required   = false
+       authorization_type = "NONE"
+       id                 = (known after apply)
+       route_key          = "POST /graphql"
+       target             = (known after apply)
    }

  # module.api_gateway.aws_apigatewayv2_stage.default[0] will be created
+   resource "aws_apigatewayv2_stage" "default" {
+       api_id        = (known after apply)
+       arn           = (known after apply)
+       auto_deploy   = true
+       deployment_id = (known after apply)
+       execution_arn = (known after apply)
+       id            = (known after apply)
+       invoke_url    = (known after apply)
+       name          = "$default"
+       tags_all      = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
    }

  # module.api_ssl_certificate.aws_acm_certificate.default[0] will be created
+   resource "aws_acm_certificate" "default" {
+       arn                       = (known after apply)
+       domain_name               = "api.staging.cpf.usdr.dev"
+       domain_validation_options = [
+           {
+               domain_name           = "api.staging.cpf.usdr.dev"
+               resource_record_name  = (known after apply)
+               resource_record_type  = (known after apply)
+               resource_record_value = (known after apply)
            },
        ]
+       id                        = (known after apply)
+       key_algorithm             = (known after apply)
+       not_after                 = (known after apply)
+       not_before                = (known after apply)
+       pending_renewal           = (known after apply)
+       renewal_eligibility       = (known after apply)
+       renewal_summary           = (known after apply)
+       status                    = (known after apply)
+       subject_alternative_names = [
+           "api.staging.cpf.usdr.dev",
        ]
+       tags_all                  = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       type                      = (known after apply)
+       validation_emails         = (known after apply)
+       validation_method         = "DNS"

+       options {
+           certificate_transparency_logging_preference = "ENABLED"
        }
    }

  # module.api_ssl_certificate.aws_acm_certificate_validation.default[0] will be created
+   resource "aws_acm_certificate_validation" "default" {
+       certificate_arn         = (known after apply)
+       id                      = (known after apply)
+       validation_record_fqdns = (known after apply)
    }

  # module.api_ssl_certificate.aws_route53_record.default["api.staging.cpf.usdr.dev"] will be created
+   resource "aws_route53_record" "default" {
+       allow_overwrite = true
+       fqdn            = (known after apply)
+       id              = (known after apply)
+       name            = (known after apply)
+       records         = (known after apply)
+       ttl             = 300
+       type            = (known after apply)
+       zone_id         = "Z10207732LTL38IPR0M4B"
    }

  # module.cdn.aws_cloudfront_distribution.this[0] will be created
+   resource "aws_cloudfront_distribution" "this" {
+       aliases                         = [
+           "staging.cpf.usdr.dev",
        ]
+       arn                             = (known after apply)
+       caller_reference                = (known after apply)
+       comment                         = "CPF Reporter website CDN."
+       continuous_deployment_policy_id = (known after apply)
+       default_root_object             = "index.html"
+       domain_name                     = (known after apply)
+       enabled                         = true
+       etag                            = (known after apply)
+       hosted_zone_id                  = (known after apply)
+       http_version                    = "http2"
+       id                              = (known after apply)
+       in_progress_validation_batches  = (known after apply)
+       is_ipv6_enabled                 = false
+       last_modified_time              = (known after apply)
+       price_class                     = "PriceClass_100"
+       retain_on_delete                = false
+       staging                         = false
+       status                          = (known after apply)
+       tags_all                        = {
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       trusted_key_groups              = (known after apply)
+       trusted_signers                 = (known after apply)
+       wait_for_deployment             = true

+       custom_error_response {
+           error_code         = 403
+           response_code      = 403
+           response_page_path = "/errors/403.html"
        }
+       custom_error_response {
+           error_code         = 404
+           response_code      = 404
+           response_page_path = "/errors/404.html"
        }

+       default_cache_behavior {
+           allowed_methods        = [
+               "GET",
+               "HEAD",
+               "OPTIONS",
            ]
+           cache_policy_id        = "658327ea-f89d-4fab-a63d-7e88639e58f6"
+           cached_methods         = [
+               "GET",
+               "HEAD",
            ]
+           compress               = true
+           default_ttl            = (known after apply)
+           max_ttl                = (known after apply)
+           min_ttl                = 0
+           target_origin_id       = "content"
+           trusted_key_groups     = (known after apply)
+           trusted_signers        = (known after apply)
+           viewer_protocol_policy = "redirect-to-https"
        }

+       logging_config {
+           bucket          = (known after apply)
+           include_cookies = false
        }

+       ordered_cache_behavior {
+           allowed_methods        = [
+               "GET",
+               "HEAD",
+               "OPTIONS",
            ]
+           cache_policy_id        = "658327ea-f89d-4fab-a63d-7e88639e58f6"
+           cached_methods         = [
+               "GET",
+               "HEAD",
            ]
+           compress               = true
+           default_ttl            = (known after apply)
+           max_ttl                = (known after apply)
+           min_ttl                = 0
+           path_pattern           = "/config/deploy-config.js"
+           target_origin_id       = "config"
+           viewer_protocol_policy = "redirect-to-https"
        }

+       origin {
+           connection_attempts = 3
+           connection_timeout  = 10
+           domain_name         = (known after apply)
+           origin_id           = "config"
+           origin_path         = "/config"

+           s3_origin_config {
+               origin_access_identity = (known after apply)
            }
        }
+       origin {
+           connection_attempts = 3
+           connection_timeout  = 10
+           domain_name         = (known after apply)
+           origin_id           = "content"
+           origin_path         = "/dist"

+           s3_origin_config {
+               origin_access_identity = (known after apply)
            }
        }

+       restrictions {
+           geo_restriction {
+               locations        = (known after apply)
+               restriction_type = "none"
            }
        }

+       viewer_certificate {
+           acm_certificate_arn      = (known after apply)
+           minimum_protocol_version = "TLSv1.2_2021"
+           ssl_support_method       = "sni-only"
        }
    }

  # module.cdn_logs_bucket.data.aws_iam_policy_document.aggregated_policy[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "aggregated_policy" {
+       id                        = (known after apply)
+       json                      = (known after apply)
+       override_policy_documents = []
+       source_policy_documents   = [
+           (known after apply),
        ]
    }

  # module.cdn_logs_bucket.data.aws_iam_policy_document.bucket_policy[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "bucket_policy" {
+       id   = (known after apply)
+       json = (known after apply)

+       statement {
+           actions   = [
+               "s3:PutObject",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
            ]
+           sid       = "DenyIncorrectEncryptionHeader"

+           condition {
+               test     = "StringNotEquals"
+               values   = [
+                   "AES256",
                ]
+               variable = "s3:x-amz-server-side-encryption"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
+       statement {
+           actions   = [
+               "s3:PutObject",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
            ]
+           sid       = "DenyUnEncryptedObjectUploads"

+           condition {
+               test     = "Null"
+               values   = [
+                   "true",
                ]
+               variable = "s3:x-amz-server-side-encryption"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
+       statement {
+           actions   = [
+               "s3:*",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
+               (known after apply),
            ]
+           sid       = "ForceSSLOnlyAccess"

+           condition {
+               test     = "Bool"
+               values   = [
+                   "false",
                ]
+               variable = "aws:SecureTransport"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
    }

  # module.cdn_logs_bucket.aws_s3_bucket.default[0] will be created
+   resource "aws_s3_bucket" "default" {
+       acceleration_status         = (known after apply)
+       acl                         = (known after apply)
+       arn                         = (known after apply)
+       bucket                      = "cpfreporter-cdn-logs-357150818708-us-west-2"
+       bucket_domain_name          = (known after apply)
+       bucket_prefix               = (known after apply)
+       bucket_regional_domain_name = (known after apply)
+       force_destroy               = false
+       hosted_zone_id              = (known after apply)
+       id                          = (known after apply)
+       object_lock_enabled         = false
+       policy                      = (known after apply)
+       region                      = (known after apply)
+       request_payer               = (known after apply)
+       tags                        = {
+           "Attributes" = "357150818708-us-west-2"
+           "Name"       = "cpfreporter-cdn-logs-357150818708-us-west-2"
+           "Namespace"  = "cpfreporter"
        }
+       tags_all                    = {
+           "Attributes" = "357150818708-us-west-2"
+           "Name"       = "cpfreporter-cdn-logs-357150818708-us-west-2"
+           "Namespace"  = "cpfreporter"
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       website_domain              = (known after apply)
+       website_endpoint            = (known after apply)
    }

  # module.cdn_logs_bucket.aws_s3_bucket_acl.default[0] will be created
+   resource "aws_s3_bucket_acl" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       access_control_policy {
+           grant {
+               permission = "FULL_CONTROL"

+               grantee {
+                   display_name = (known after apply)
+                   id           = "c4c1ede66af53448b93c283ce9448c4ba468c9432aa01d700d3878632f77d2d0"
+                   type         = "CanonicalUser"
                }
            }
+           owner {
+               display_name = (known after apply)
+               id           = "908fcaa3526bcd94649f1b7d5e57a2d26eed8383a46040a685ea6c39d3b3f6c0"
            }
        }
    }

  # module.cdn_logs_bucket.aws_s3_bucket_lifecycle_configuration.default[0] will be created
+   resource "aws_s3_bucket_lifecycle_configuration" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       rule {
+           id     = "rule-1"
+           status = "Enabled"

+           abort_incomplete_multipart_upload {
+               days_after_initiation = 7
            }

+           expiration {
+               days                         = 14
+               expired_object_delete_marker = (known after apply)
            }

+           filter {
            }

+           noncurrent_version_expiration {
+               noncurrent_days = 14
            }

+           noncurrent_version_transition {
+               noncurrent_days = 30
+               storage_class   = "GLACIER"
            }

+           transition {
+               days          = 30
+               storage_class = "STANDARD_IA"
            }
+           transition {
+               days          = 60
+               storage_class = "GLACIER"
            }
        }
    }

  # module.cdn_logs_bucket.aws_s3_bucket_ownership_controls.default[0] will be created
+   resource "aws_s3_bucket_ownership_controls" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       rule {
+           object_ownership = "BucketOwnerPreferred"
        }
    }

  # module.cdn_logs_bucket.aws_s3_bucket_policy.default[0] will be created
+   resource "aws_s3_bucket_policy" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)
+       policy = (known after apply)
    }

  # module.cdn_logs_bucket.aws_s3_bucket_public_access_block.default[0] will be created
+   resource "aws_s3_bucket_public_access_block" "default" {
+       block_public_acls       = true
+       block_public_policy     = true
+       bucket                  = (known after apply)
+       id                      = (known after apply)
+       ignore_public_acls      = true
+       restrict_public_buckets = true
    }

  # module.cdn_logs_bucket.aws_s3_bucket_server_side_encryption_configuration.default[0] will be created
+   resource "aws_s3_bucket_server_side_encryption_configuration" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       rule {
+           bucket_key_enabled = false

+           apply_server_side_encryption_by_default {
+               sse_algorithm = "AES256"
            }
        }
    }

  # module.cdn_logs_bucket.aws_s3_bucket_versioning.default[0] will be created
+   resource "aws_s3_bucket_versioning" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       versioning_configuration {
+           mfa_delete = (known after apply)
+           status     = "Suspended"
        }
    }

  # module.cdn_logs_bucket.time_sleep.wait_for_aws_s3_bucket_settings[0] will be created
+   resource "time_sleep" "wait_for_aws_s3_bucket_settings" {
+       create_duration  = "30s"
+       destroy_duration = "30s"
+       id               = (known after apply)
    }

  # module.cdn_origin_bucket.data.aws_iam_policy_document.aggregated_policy[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "aggregated_policy" {
+       id                        = (known after apply)
+       json                      = (known after apply)
+       override_policy_documents = [
+           (known after apply),
        ]
+       source_policy_documents   = [
+           (known after apply),
        ]
    }

  # module.cdn_origin_bucket.data.aws_iam_policy_document.bucket_policy[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "bucket_policy" {
+       id   = (known after apply)
+       json = (known after apply)

+       statement {
+           actions   = [
+               "s3:PutObject",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
            ]
+           sid       = "DenyIncorrectEncryptionHeader"

+           condition {
+               test     = "StringNotEquals"
+               values   = [
+                   "AES256",
                ]
+               variable = "s3:x-amz-server-side-encryption"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
+       statement {
+           actions   = [
+               "s3:PutObject",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
            ]
+           sid       = "DenyUnEncryptedObjectUploads"

+           condition {
+               test     = "Null"
+               values   = [
+                   "true",
                ]
+               variable = "s3:x-amz-server-side-encryption"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
+       statement {
+           actions   = [
+               "s3:*",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
+               (known after apply),
            ]
+           sid       = "ForceSSLOnlyAccess"

+           condition {
+               test     = "Bool"
+               values   = [
+                   "false",
                ]
+               variable = "aws:SecureTransport"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
    }

  # module.cdn_origin_bucket.aws_s3_bucket.default[0] will be created
+   resource "aws_s3_bucket" "default" {
+       acceleration_status         = (known after apply)
+       acl                         = (known after apply)
+       arn                         = (known after apply)
+       bucket                      = "cpfreporter-origin-357150818708-us-west-2"
+       bucket_domain_name          = (known after apply)
+       bucket_prefix               = (known after apply)
+       bucket_regional_domain_name = (known after apply)
+       force_destroy               = false
+       hosted_zone_id              = (known after apply)
+       id                          = (known after apply)
+       object_lock_enabled         = false
+       policy                      = (known after apply)
+       region                      = (known after apply)
+       request_payer               = (known after apply)
+       tags                        = {
+           "Attributes" = "357150818708-us-west-2"
+           "Name"       = "cpfreporter-origin-357150818708-us-west-2"
+           "Namespace"  = "cpfreporter"
        }
+       tags_all                    = {
+           "Attributes" = "357150818708-us-west-2"
+           "Name"       = "cpfreporter-origin-357150818708-us-west-2"
+           "Namespace"  = "cpfreporter"
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       website_domain              = (known after apply)
+       website_endpoint            = (known after apply)
    }

  # module.cdn_origin_bucket.aws_s3_bucket_acl.default[0] will be created
+   resource "aws_s3_bucket_acl" "default" {
+       acl    = "private"
+       bucket = (known after apply)
+       id     = (known after apply)
    }

  # module.cdn_origin_bucket.aws_s3_bucket_lifecycle_configuration.default[0] will be created
+   resource "aws_s3_bucket_lifecycle_configuration" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       rule {
+           id     = "rule-1"
+           status = "Enabled"

+           abort_incomplete_multipart_upload {
+               days_after_initiation = 1
            }

+           filter {
            }

+           noncurrent_version_expiration {
+               noncurrent_days = 7
            }
        }
    }

  # module.cdn_origin_bucket.aws_s3_bucket_ownership_controls.default[0] will be created
+   resource "aws_s3_bucket_ownership_controls" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       rule {
+           object_ownership = "ObjectWriter"
        }
    }

  # module.cdn_origin_bucket.aws_s3_bucket_policy.default[0] will be created
+   resource "aws_s3_bucket_policy" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)
+       policy = (known after apply)
    }

  # module.cdn_origin_bucket.aws_s3_bucket_public_access_block.default[0] will be created
+   resource "aws_s3_bucket_public_access_block" "default" {
+       block_public_acls       = true
+       block_public_policy     = true
+       bucket                  = (known after apply)
+       id                      = (known after apply)
+       ignore_public_acls      = true
+       restrict_public_buckets = true
    }

  # module.cdn_origin_bucket.aws_s3_bucket_server_side_encryption_configuration.default[0] will be created
+   resource "aws_s3_bucket_server_side_encryption_configuration" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       rule {
+           bucket_key_enabled = false

+           apply_server_side_encryption_by_default {
+               sse_algorithm = "AES256"
            }
        }
    }

  # module.cdn_origin_bucket.aws_s3_bucket_versioning.default[0] will be created
+   resource "aws_s3_bucket_versioning" "default" {
+       bucket = (known after apply)
+       id     = (known after apply)

+       versioning_configuration {
+           mfa_delete = (known after apply)
+           status     = "Enabled"
        }
    }

  # module.cdn_origin_bucket.time_sleep.wait_for_aws_s3_bucket_settings[0] will be created
+   resource "time_sleep" "wait_for_aws_s3_bucket_settings" {
+       create_duration  = "30s"
+       destroy_duration = "30s"
+       id               = (known after apply)
    }

  # module.cloudfront_ssl_certificate.aws_acm_certificate.default[0] will be created
+   resource "aws_acm_certificate" "default" {
+       arn                       = (known after apply)
+       domain_name               = "staging.cpf.usdr.dev"
+       domain_validation_options = [
+           {
+               domain_name           = "staging.cpf.usdr.dev"
+               resource_record_name  = (known after apply)
+               resource_record_type  = (known after apply)
+               resource_record_value = (known after apply)
            },
        ]
+       id                        = (known after apply)
+       key_algorithm             = (known after apply)
+       not_after                 = (known after apply)
+       not_before                = (known after apply)
+       pending_renewal           = (known after apply)
+       renewal_eligibility       = (known after apply)
+       renewal_summary           = (known after apply)
+       status                    = (known after apply)
+       subject_alternative_names = [
+           "staging.cpf.usdr.dev",
        ]
+       tags                      = {
+           "Name"      = "cpfreporter"
+           "Namespace" = "cpfreporter"
        }
+       tags_all                  = {
+           "Name"       = "cpfreporter"
+           "Namespace"  = "cpfreporter"
+           "env"        = "staging"
+           "management" = "terraform"
+           "owner"      = "grants"
+           "repo"       = "cpf-reporter"
+           "service"    = "cpf-reporter"
+           "usage"      = "workload"
        }
+       type                      = (known after apply)
+       validation_emails         = (known after apply)
+       validation_method         = "DNS"

+       options {
+           certificate_transparency_logging_preference = "ENABLED"
        }
    }

  # module.cloudfront_ssl_certificate.aws_acm_certificate_validation.default[0] will be created
+   resource "aws_acm_certificate_validation" "default" {
+       certificate_arn         = (known after apply)
+       id                      = (known after apply)
+       validation_record_fqdns = (known after apply)
    }

  # module.cloudfront_ssl_certificate.aws_route53_record.default["staging.cpf.usdr.dev"] will be created
+   resource "aws_route53_record" "default" {
+       allow_overwrite = true
+       fqdn            = (known after apply)
+       id              = (known after apply)
+       name            = (known after apply)
+       records         = (known after apply)
+       ttl             = 300
+       type            = (known after apply)
+       zone_id         = "Z10207732LTL38IPR0M4B"
    }

  # module.cloudfront_to_origin_bucket_access_policy.data.aws_iam_policy_document.policy[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "policy" {
+       id   = (known after apply)
+       json = (known after apply)

+       statement {
+           actions   = [
+               "s3:GetObject",
            ]
+           effect    = "Allow"
+           resources = [
+               (known after apply),
+               (known after apply),
            ]
+           sid       = "S3GetObjectForCloudFront"
        }
+       statement {
+           actions   = [
+               "s3:ListBucket",
            ]
+           effect    = "Allow"
+           resources = [
+               (known after apply),
            ]
+           sid       = "S3ListBucketForCloudFront"

+           principals {
+               identifiers = [
+                   (known after apply),
                ]
+               type        = "AWS"
            }
        }
    }

  # module.cloudfront_to_origin_bucket_access_policy.data.aws_iam_policy_document.this[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "this" {
+       id                        = (known after apply)
+       json                      = (known after apply)
+       override_policy_documents = []
+       source_policy_documents   = (known after apply)
    }

  # module.lambda_artifacts_bucket.data.aws_iam_policy_document.aggregated_policy[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "aggregated_policy" {
+       id                        = (known after apply)
+       json                      = (known after apply)
+       override_policy_documents = []
+       source_policy_documents   = [
+           (known after apply),
        ]
    }

  # module.lambda_artifacts_bucket.data.aws_iam_policy_document.bucket_policy[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "bucket_policy" {
+       id   = (known after apply)
+       json = (known after apply)

+       statement {
+           actions   = [
+               "s3:PutObject",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
            ]
+           sid       = "DenyIncorrectEncryptionHeader"

+           condition {
+               test     = "StringNotEquals"
+               values   = [
+                   "AES256",
                ]
+               variable = "s3:x-amz-server-side-encryption"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
+       statement {
+           actions   = [
+               "s3:PutObject",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
            ]
+           sid       = "DenyUnEncryptedObjectUploads"

+           condition {
+               test     = "Null"
+               values   = [
+                   "true",
                ]
+               variable = "s3:x-amz-server-side-encryption"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
+       statement {
+           actions   = [
+               "s3:*",
            ]
+           effect    = "Deny"
+           resources = [
+               (known after apply),
+               (known after apply),
            ]
+           sid       = "ForceSSLOnlyAccess"

+           condition {
+               test     = "Bool"
+               values   = [
+                   "false",
                ]
+               variable = "aws:SecureTransport"
            }

+           principals {
+               identifiers = [
+                   "*",
                ]
+               type        = "*"
            }
        }
    }

  # module.lambda_artifacts_bucket.aws_s3_bucket.default[0] will be created
+   resource "aws_s3_bucket" "default" {
+       acceleration_status         = (known after apply)
+       acl                         = (known after apply)
+       arn                         = (known after apply)
+       bucket                      = "cpfreporter-lambdaartifacts-357150818708-us-west-2"
+       bucket_domain_name          = (known after apply)
+       bucket_prefix               = (known after appl...*[Comment body truncated]*

@TylerHendrickson TylerHendrickson requested a review from a team December 5, 2023 19:51
@TylerHendrickson TylerHendrickson added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 5, 2023
@TylerHendrickson TylerHendrickson marked this pull request as ready for review December 5, 2023 19:51
Copy link
Contributor

@as1729 as1729 left a comment

Choose a reason for hiding this comment

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

Excited to see a Lambda based setup. No blockers on my end for this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants