Skip to content

Commit a053a0a

Browse files
Merge pull request #68 from NHSDigital/feature/CCM-9648-shared-module-module-usage
CCM-9648 - standardise tfscaffold conventions
2 parents 3310fdf + a7967e5 commit a053a0a

21 files changed

Lines changed: 34 additions & 112 deletions

File tree

infrastructure/modules/amp_branch/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
| <a name="input_environment_variables"></a> [environment\_variables](#input\_environment\_variables) | Environment variables to be used for amplify branch | `map(string)` | `{}` | no |
2525
| <a name="input_framework"></a> [framework](#input\_framework) | Set what framework to use | `string` | `null` | no |
2626
| <a name="input_group"></a> [group](#input\_group) | The group variables are being inherited from (often synonmous with account short-name) | `string` | n/a | yes |
27-
| <a name="input_module"></a> [module](#input\_module) | The name of this module. This is a special variable, it should be set only here and never overridden. | `string` | `"kms"` | no |
2827
| <a name="input_name"></a> [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes |
2928
| <a name="input_project"></a> [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes |
3029
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |

infrastructure/modules/amp_branch/locals.tf

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
locals {
2+
module = "amp"
3+
24
csi = format(
3-
"%s-%s-%s-%s-%s",
5+
"%s-%s-%s-%s",
46
var.project,
57
var.environment,
68
var.component,
7-
var.module,
89
var.name,
910
)
1011

11-
# CSI for use in resources with an account namespace, eg IAM roles
12-
csi_account = replace(
13-
format(
14-
"%s-%s-%s-%s-%s-%s",
15-
var.project,
16-
var.region,
17-
var.environment,
18-
var.component,
19-
var.module,
20-
var.name,
21-
),
22-
"_",
23-
"",
24-
)
25-
2612
default_tags = merge(
2713
var.default_tags,
2814
{
29-
Module = var.module
15+
Module = local.module
3016
Name = local.csi
3117
},
3218
)

infrastructure/modules/amp_branch/variables.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,6 @@ variable "description" {
3232
description = "Description for the branch"
3333
}
3434

35-
##
36-
# Module self-identification
37-
##
38-
39-
variable "module" {
40-
type = string
41-
description = "The name of this module. This is a special variable, it should be set only here and never overridden."
42-
default = "kms"
43-
}
44-
4535
##
4636
# Variable specific to the module
4737
##

infrastructure/modules/aws-backup-source/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ No requirements.
6262
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | Default tag map for application to all taggable resources in the module | `map(string)` | `{}` | no |
6363
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the environment where AWS Backup is configured. | `string` | n/a | yes |
6464
| <a name="input_management_ci_role_arn"></a> [management\_ci\_role\_arn](#input\_management\_ci\_role\_arn) | ARN of Terraform role used to deploy to account | `string` | n/a | yes |
65+
| <a name="input_name"></a> [name](#input\_name) | The variable encapsulating the name of this bucket | `string` | n/a | yes |
6566
| <a name="input_notification_kms_key"></a> [notification\_kms\_key](#input\_notification\_kms\_key) | The ARN of the bootstrap KMS key used for encryption at rest of the SNS topic. | `string` | n/a | yes |
6667
| <a name="input_notifications_target_email_address"></a> [notifications\_target\_email\_address](#input\_notifications\_target\_email\_address) | The email address to which backup notifications will be sent via SNS. | `string` | `""` | no |
6768
| <a name="input_principal_org_id"></a> [principal\_org\_id](#input\_principal\_org\_id) | The AWS Org ID (numeric) | `string` | n/a | yes |
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
locals {
2+
module = "backup"
3+
24
csi = format(
35
"%s-%s-%s-%s",
46
var.project,
57
var.environment,
68
var.component,
7-
"backup"
9+
var.name
810
)
911

1012
csi_underscore = replace(local.csi,"-","_")
@@ -13,6 +15,7 @@ locals {
1315
var.default_tags,
1416
{
1517
Name = local.csi
18+
Module = local.module
1619
},
1720
)
1821
}

infrastructure/modules/aws-backup-source/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ variable "component" {
1313
description = "The name of the tfscaffold component"
1414
}
1515

16+
variable "name" {
17+
type = string
18+
description = "The variable encapsulating the name of this bucket"
19+
}
20+
1621
variable "default_tags" {
1722
type = map(string)
1823
description = "Default tag map for application to all taggable resources in the module"

infrastructure/modules/eventpub/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | KMS key arn to use for this function | `string` | n/a | yes |
2626
| <a name="input_log_level"></a> [log\_level](#input\_log\_level) | The log level to be used in lambda functions within the component. Any log with a lower severity than the configured value will not be logged: https://docs.python.org/3/library/logging.html#levels | `string` | `"WARN"` | no |
2727
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The retention period in days for the Cloudwatch Logs events generated by the lambda function | `number` | n/a | yes |
28-
| <a name="input_module"></a> [module](#input\_module) | The name of this module. This is a special variable, it should be set only here and never overridden. | `string` | `"eventpub"` | no |
2928
| <a name="input_name"></a> [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes |
3029
| <a name="input_project"></a> [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes |
3130
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |

infrastructure/modules/eventpub/locals.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
locals {
2+
module = "eventpub"
3+
24
csi = replace(
35
format(
46
"%s-%s-%s-%s",
@@ -13,7 +15,7 @@ locals {
1315
default_tags = merge(
1416
var.default_tags,
1517
{
16-
Module = var.module
18+
Module = local.module
1719
Name = local.csi
1820
},
1921
)

infrastructure/modules/eventpub/variables.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ variable "group" {
2828
default = null
2929
}
3030

31-
##
32-
# Module self-identification
33-
##
34-
35-
variable "module" {
36-
type = string
37-
description = "The name of this module. This is a special variable, it should be set only here and never overridden."
38-
default = "eventpub"
39-
}
40-
4131
##
4232
# Variable specific to the module
4333
##

infrastructure/modules/kms/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the terraformscaffold environment the module is called for | `string` | n/a | yes |
2020
| <a name="input_iam_delegation"></a> [iam\_delegation](#input\_iam\_delegation) | Whether to delegate administration of the key to the local account. Defaults to true | `bool` | `true` | no |
2121
| <a name="input_key_policy_documents"></a> [key\_policy\_documents](#input\_key\_policy\_documents) | List of KMS key policy JSON documents | `list(string)` | `[]` | no |
22-
| <a name="input_module"></a> [module](#input\_module) | The name of this module. This is a special variable, it should be set only here and never overridden. | `string` | `"kms"` | no |
2322
| <a name="input_name"></a> [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes |
2423
| <a name="input_project"></a> [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes |
2524
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |

0 commit comments

Comments
 (0)