File tree Expand file tree Collapse file tree 5 files changed +14
-11
lines changed
Expand file tree Collapse file tree 5 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 2626init-reconfigure :
2727 $(tf_cmd ) init $(tf_state ) -upgrade $(tf_vars ) -reconfigure
2828
29- plan :
29+ plan : workspace
3030 $(tf_cmd ) plan $(tf_vars )
3131
3232plan-changes : workspace
Original file line number Diff line number Diff line change 11locals {
22 # NHSD cert file
3- truststore_file_name = " server-renewed-cert.pem"
3+ truststore_file_name = var . environment == " int " ? " imms-int-cert.pem " : " server-renewed-cert.pem"
44}
55
66data "aws_s3_bucket" "cert_storage" {
@@ -9,16 +9,16 @@ data "aws_s3_bucket" "cert_storage" {
99
1010data "aws_s3_object" "cert" {
1111 bucket = data. aws_s3_bucket . cert_storage . bucket
12- key = local. truststore_file_name
12+ key = local. truststore_file_name
1313}
1414
1515resource "aws_s3_bucket" "truststore_bucket" {
16- bucket = " ${ var . prefix } -truststores"
16+ bucket = " ${ var . prefix } -truststores"
1717 force_destroy = true
1818}
1919
2020resource "aws_s3_object_copy" "copy_cert_from_storage" {
2121 bucket = aws_s3_bucket. truststore_bucket . bucket
2222 key = local. truststore_file_name
23- source = " ${ data . aws_s3_object . cert . bucket } /${ local . truststore_file_name } "
23+ source = " ${ data . aws_s3_object . cert . bucket } /${ local . truststore_file_name } "
2424}
Original file line number Diff line number Diff line change 1+
12resource "aws_dynamodb_table" "audit-table" {
2- name = " immunisation-batch-${ local . environment } -audit-table"
3+ name = " immunisation-batch-${ local . unique_name } -audit-table"
34 billing_mode = " PAY_PER_REQUEST"
45 hash_key = " message_id"
56
@@ -47,7 +48,7 @@ resource "aws_dynamodb_table" "audit-table" {
4748}
4849
4950resource "aws_dynamodb_table" "delta-dynamodb-table" {
50- name = " imms-${ local . environment } -delta"
51+ name = " imms-${ local . unique_name } -delta"
5152 billing_mode = " PAY_PER_REQUEST"
5253 hash_key = " PK"
5354
@@ -106,7 +107,7 @@ resource "aws_dynamodb_table" "delta-dynamodb-table" {
106107}
107108
108109resource "aws_dynamodb_table" "events-dynamodb-table" {
109- name = " imms-${ local . environment } -imms-events"
110+ name = " imms-${ local . unique_name } -imms-events"
110111 billing_mode = " PAY_PER_REQUEST"
111112 hash_key = " PK"
112113 stream_enabled = true
Original file line number Diff line number Diff line change 1+
12resource "aws_s3_bucket" "batch_data_source_bucket" {
23 bucket = " ${ local . batch_prefix } -data-sources"
34 force_destroy = local. is_temp
@@ -93,7 +94,7 @@ resource "aws_s3_bucket_lifecycle_configuration" "datasources_lifecycle" {
9394
9495resource "aws_s3_bucket" "batch_data_destination_bucket" {
9596 # Deliberately not using `local.batch_prefix` as we don't want separate blue / green destinations in prod.
96- bucket = " immunisation-batch-${ local . environment } -data-destinations"
97+ bucket = " immunisation-batch-${ local . unique_name } -data-destinations"
9798 force_destroy = local. is_temp
9899}
99100
@@ -195,7 +196,7 @@ resource "aws_s3_bucket" "batch_config_bucket" {
195196 # For now, only create in internal-dev and prod as we only have one shared Redis instance per account.
196197 count = local. create_config_bucket ? 1 : 0
197198
198- bucket = " imms-${ local . environment } -supplier-config"
199+ bucket = " imms-${ local . unique_name } -supplier-config"
199200}
200201
201202resource "aws_s3_bucket_public_access_block" "batch_config_bucket_public_access_block" {
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ locals {
2121 env = terraform. workspace
2222 prefix = var. aws_account_name == " int" ? " ${ var . project_name } -${ var . service } -${ local . env } -int" : " ${ var . project_name } -${ var . service } -${ local . env } "
2323 short_prefix = var. aws_account_name == " int" ? " ${ var . project_short_name } -${ local . env } -int" : " ${ var . project_short_name } -${ local . env } "
24- batch_prefix = " immunisation-batch-${ local . env } "
24+ batch_prefix = var . aws_account_name == " int " ? " immunisation-batch- ${ local . env } -int " : " immunisation-batch-${ local . env } "
2525 config_env = var. aws_account_name
2626 config_bucket_env = local. environment == " prod" ? " prod" : " internal-dev"
2727
@@ -33,6 +33,7 @@ locals {
3333 create_config_bucket = true
3434 config_bucket_arn = local. create_config_bucket ? aws_s3_bucket. batch_config_bucket [0 ]. arn : data. aws_s3_bucket . existing_config_bucket [0 ]. arn
3535 config_bucket_name = local. create_config_bucket ? aws_s3_bucket. batch_config_bucket [0 ]. bucket : data. aws_s3_bucket . existing_config_bucket [0 ]. bucket
36+ unique_name = var. aws_account_name == " int" ? " preprod-${ var . aws_account_name } " : var. aws_account_name # Because some dbs already exist with that name
3637}
3738
3839data "aws_vpc" "default" {
You can’t perform that action at this time.
0 commit comments