Skip to content

Commit fb1b8d1

Browse files
committed
eli-239 making resources workflow safe and amending dynamoDB naming to fit DPS required pattern
1 parent 377c8a4 commit fb1b8d1

11 files changed

Lines changed: 19 additions & 44 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/default_variables.tf

infrastructure/modules/dynamodb/dynamodb.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_dynamodb_table" "dynamodb_table" {
2-
name = "${terraform.workspace == "default" ? "" : "${terraform.workspace}-"}${var.table_name_suffix}"
2+
name = "${terraform.workspace == "default" ? "" : "${terraform.workspace}-"}${var.project_name}-${var.environment}-${var.table_name_suffix}"
33
billing_mode = "PAY_PER_REQUEST"
44
hash_key = var.partition_key
55

infrastructure/modules/dynamodb/variables.tf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
variable "workspace" {
2-
description = "Usually the developer short code or the name of the environment."
3-
type = string
4-
}
5-
6-
variable "project_name" {
7-
default = "eligibility-signposting-api"
8-
type = string
9-
}
10-
111
variable "table_name_suffix" {
122
description = "Name of the DynamoDB table"
133
type = string
@@ -34,9 +24,3 @@ variable "sort_key_type" {
3424
type = string
3525
default = null
3626
}
37-
38-
variable "tags" {
39-
description = "A map of tags to assign to resources."
40-
type = map(string)
41-
default = {}
42-
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../_shared/default_variables.tf

infrastructure/modules/s3/variables.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ variable "bucket_name" {
33
type = string
44
}
55

6-
variable "project_name" {
7-
default = "eligibility-signposting-api"
8-
type = string
9-
}
10-
11-
variable "environment" {
12-
description = "The purpose of the account dev/test/ref/prod or the workspace"
13-
type = string
14-
}
15-
166
variable "bucket_expiration_days" {
177
default = 90
188
description = "How long to keep bucket contents before expiring"

infrastructure/stacks/_shared/default_variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ variable "default_aws_region" {
1515
description = "Default AWS region"
1616
type = string
1717
}
18+
19+
variable "workspace" {
20+
description = "Usually the developer short code or the name of the environment."
21+
type = string
22+
}

infrastructure/stacks/_shared/locals.tf

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,9 @@ locals {
1717
workspace = lower(terraform.workspace)
1818
}
1919

20-
sso_role_patterns = {
21-
dev = "AWSReservedSSO_vdselid_dev_*"
22-
test = "AWSReservedSSO_vdselid_test_*"
23-
preprod = "AWSReservedSSO_vdselid_preprod_*"
24-
}
25-
2620
terraform_state_bucket_name = "eligibility-signposting-api-${var.environment}-tfstate"
2721
terraform_state_bucket_arn = "arn:aws:s3:::eligibility-signposting-api-${var.environment}-tfstate"
2822

29-
account_ids = {
30-
dev = "448049830832"
31-
test = "050451367081"
32-
preprod = "203918864209"
33-
# prod = "476114145616"
34-
}
35-
36-
current_account_id = lookup(local.account_ids, var.environment, data.aws_caller_identity.current.account_id)
37-
3823
role_arn_pre = "arn:aws:iam::603871901111:role/db-system-worker"
3924
role_arn_prod = "arn:aws:iam::232116723729:role/db-system-worker"
4025

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module "eligibility_status_table" {
22
source = "../../modules/dynamodb"
33
workspace = local.workspace
4-
table_name_suffix = "eligibilty_data_store"
4+
table_name_suffix = "eligibility_datastore"
55
partition_key = "NHS_NUMBER"
66
partition_key_type = "S"
77
sort_key = "ATTRIBUTE_TYPE"
88
sort_key_type = "S"
99
tags = local.tags
10+
environment = local.environment
11+
stack_name = local.stack_name
1012
}

infrastructure/stacks/bootstrap/locals.tf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
locals {
2+
3+
stack_name = "bootstrap"
4+
5+
}

0 commit comments

Comments
 (0)