diff --git a/infrastructure/modules/amp_branch/README.md b/infrastructure/modules/amp_branch/README.md index df1b998..659e9c1 100644 --- a/infrastructure/modules/amp_branch/README.md +++ b/infrastructure/modules/amp_branch/README.md @@ -24,7 +24,6 @@ | [environment\_variables](#input\_environment\_variables) | Environment variables to be used for amplify branch | `map(string)` | `{}` | no | | [framework](#input\_framework) | Set what framework to use | `string` | `null` | no | | [group](#input\_group) | The group variables are being inherited from (often synonmous with account short-name) | `string` | n/a | yes | -| [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 | | [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes | | [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes | | [region](#input\_region) | The AWS Region | `string` | n/a | yes | diff --git a/infrastructure/modules/amp_branch/locals.tf b/infrastructure/modules/amp_branch/locals.tf index 8d1bc72..32f37c9 100644 --- a/infrastructure/modules/amp_branch/locals.tf +++ b/infrastructure/modules/amp_branch/locals.tf @@ -1,32 +1,18 @@ locals { + module = "amp" + csi = format( - "%s-%s-%s-%s-%s", + "%s-%s-%s-%s", var.project, var.environment, var.component, - var.module, var.name, ) - # CSI for use in resources with an account namespace, eg IAM roles - csi_account = replace( - format( - "%s-%s-%s-%s-%s-%s", - var.project, - var.region, - var.environment, - var.component, - var.module, - var.name, - ), - "_", - "", - ) - default_tags = merge( var.default_tags, { - Module = var.module + Module = local.module Name = local.csi }, ) diff --git a/infrastructure/modules/amp_branch/variables.tf b/infrastructure/modules/amp_branch/variables.tf index 1899d44..c80657b 100644 --- a/infrastructure/modules/amp_branch/variables.tf +++ b/infrastructure/modules/amp_branch/variables.tf @@ -32,16 +32,6 @@ variable "description" { description = "Description for the branch" } -## -# Module self-identification -## - -variable "module" { - type = string - description = "The name of this module. This is a special variable, it should be set only here and never overridden." - default = "kms" -} - ## # Variable specific to the module ## diff --git a/infrastructure/modules/aws-backup-source/README.md b/infrastructure/modules/aws-backup-source/README.md index 5831b71..64352d7 100644 --- a/infrastructure/modules/aws-backup-source/README.md +++ b/infrastructure/modules/aws-backup-source/README.md @@ -62,6 +62,7 @@ No requirements. | [default\_tags](#input\_default\_tags) | Default tag map for application to all taggable resources in the module | `map(string)` | `{}` | no | | [environment](#input\_environment) | The name of the environment where AWS Backup is configured. | `string` | n/a | yes | | [management\_ci\_role\_arn](#input\_management\_ci\_role\_arn) | ARN of Terraform role used to deploy to account | `string` | n/a | yes | +| [name](#input\_name) | The variable encapsulating the name of this bucket | `string` | n/a | yes | | [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 | | [notifications\_target\_email\_address](#input\_notifications\_target\_email\_address) | The email address to which backup notifications will be sent via SNS. | `string` | `""` | no | | [principal\_org\_id](#input\_principal\_org\_id) | The AWS Org ID (numeric) | `string` | n/a | yes | diff --git a/infrastructure/modules/aws-backup-source/locals.tf b/infrastructure/modules/aws-backup-source/locals.tf index 4e2d28d..4a6ef1a 100644 --- a/infrastructure/modules/aws-backup-source/locals.tf +++ b/infrastructure/modules/aws-backup-source/locals.tf @@ -1,10 +1,12 @@ locals { + module = "backup" + csi = format( "%s-%s-%s-%s", var.project, var.environment, var.component, - "backup" + var.name ) csi_underscore = replace(local.csi,"-","_") @@ -13,6 +15,7 @@ locals { var.default_tags, { Name = local.csi + Module = local.module }, ) } diff --git a/infrastructure/modules/aws-backup-source/variables.tf b/infrastructure/modules/aws-backup-source/variables.tf index 298c898..9a445d8 100644 --- a/infrastructure/modules/aws-backup-source/variables.tf +++ b/infrastructure/modules/aws-backup-source/variables.tf @@ -13,6 +13,11 @@ variable "component" { description = "The name of the tfscaffold component" } +variable "name" { + type = string + description = "The variable encapsulating the name of this bucket" +} + variable "default_tags" { type = map(string) description = "Default tag map for application to all taggable resources in the module" diff --git a/infrastructure/modules/eventpub/README.md b/infrastructure/modules/eventpub/README.md index e5a2b53..d05d212 100644 --- a/infrastructure/modules/eventpub/README.md +++ b/infrastructure/modules/eventpub/README.md @@ -25,7 +25,6 @@ | [kms\_key\_arn](#input\_kms\_key\_arn) | KMS key arn to use for this function | `string` | n/a | yes | | [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 | | [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 | -| [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 | | [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes | | [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes | | [region](#input\_region) | The AWS Region | `string` | n/a | yes | diff --git a/infrastructure/modules/eventpub/locals.tf b/infrastructure/modules/eventpub/locals.tf index d08d42d..796ad69 100644 --- a/infrastructure/modules/eventpub/locals.tf +++ b/infrastructure/modules/eventpub/locals.tf @@ -1,4 +1,6 @@ locals { + module = "eventpub" + csi = replace( format( "%s-%s-%s-%s", @@ -13,7 +15,7 @@ locals { default_tags = merge( var.default_tags, { - Module = var.module + Module = local.module Name = local.csi }, ) diff --git a/infrastructure/modules/eventpub/variables.tf b/infrastructure/modules/eventpub/variables.tf index de80232..7e81658 100644 --- a/infrastructure/modules/eventpub/variables.tf +++ b/infrastructure/modules/eventpub/variables.tf @@ -28,16 +28,6 @@ variable "group" { default = null } -## -# Module self-identification -## - -variable "module" { - type = string - description = "The name of this module. This is a special variable, it should be set only here and never overridden." - default = "eventpub" -} - ## # Variable specific to the module ## diff --git a/infrastructure/modules/kms/README.md b/infrastructure/modules/kms/README.md index 8f778e7..8beec34 100644 --- a/infrastructure/modules/kms/README.md +++ b/infrastructure/modules/kms/README.md @@ -19,7 +19,6 @@ | [environment](#input\_environment) | The name of the terraformscaffold environment the module is called for | `string` | n/a | yes | | [iam\_delegation](#input\_iam\_delegation) | Whether to delegate administration of the key to the local account. Defaults to true | `bool` | `true` | no | | [key\_policy\_documents](#input\_key\_policy\_documents) | List of KMS key policy JSON documents | `list(string)` | `[]` | no | -| [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 | | [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes | | [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes | | [region](#input\_region) | The AWS Region | `string` | n/a | yes | diff --git a/infrastructure/modules/kms/locals.tf b/infrastructure/modules/kms/locals.tf index 8d1bc72..c6b4414 100644 --- a/infrastructure/modules/kms/locals.tf +++ b/infrastructure/modules/kms/locals.tf @@ -1,22 +1,22 @@ locals { + module = "kms" + csi = format( - "%s-%s-%s-%s-%s", + "%s-%s-%s-%s", var.project, var.environment, var.component, - var.module, var.name, ) # CSI for use in resources with an account namespace, eg IAM roles csi_account = replace( format( - "%s-%s-%s-%s-%s-%s", + "%s-%s-%s-%s-%s", var.project, var.region, var.environment, var.component, - var.module, var.name, ), "_", @@ -26,7 +26,7 @@ locals { default_tags = merge( var.default_tags, { - Module = var.module + Module = local.module Name = local.csi }, ) diff --git a/infrastructure/modules/kms/variables.tf b/infrastructure/modules/kms/variables.tf index a6a7fdb..a05cd77 100644 --- a/infrastructure/modules/kms/variables.tf +++ b/infrastructure/modules/kms/variables.tf @@ -22,16 +22,6 @@ variable "aws_account_id" { description = "The AWS Account ID (numeric)" } -## -# Module self-identification -## - -variable "module" { - type = string - description = "The name of this module. This is a special variable, it should be set only here and never overridden." - default = "kms" -} - ## # Variable specific to the module ## diff --git a/infrastructure/modules/lambda/README.md b/infrastructure/modules/lambda/README.md index 78ec1a7..5482e26 100644 --- a/infrastructure/modules/lambda/README.md +++ b/infrastructure/modules/lambda/README.md @@ -38,7 +38,6 @@ | [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 | | [log\_subscription\_lambda\_create\_permission](#input\_log\_subscription\_lambda\_create\_permission) | Whether to create a permission for the log forwarder. Set to false if using a generic one. | `bool` | `true` | no | | [memory](#input\_memory) | The amount of memory to apply to the created Lambda | `number` | n/a | yes | -| [module](#input\_module) | The variable encapsulating the name of this module | `string` | `"lambda"` | no | | [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes | | [region](#input\_region) | The AWS Region | `string` | n/a | yes | | [runtime](#input\_runtime) | The runtime to use for the lambda function | `string` | n/a | yes | diff --git a/infrastructure/modules/lambda/locals.tf b/infrastructure/modules/lambda/locals.tf index f009227..04398ea 100644 --- a/infrastructure/modules/lambda/locals.tf +++ b/infrastructure/modules/lambda/locals.tf @@ -1,12 +1,13 @@ locals { + module = "lambda" + # Compound Scope Identifier csi = replace( format( - "%s-%s-%s-%s-%s", + "%s-%s-%s-%s", var.project, var.environment, var.component, - var.module, var.function_name, ), "_", @@ -16,7 +17,8 @@ locals { default_tags = merge( var.default_tags, { - "Module" = var.module + "Name" = local.csi + "Module" = local.module }, ) } diff --git a/infrastructure/modules/lambda/variables.tf b/infrastructure/modules/lambda/variables.tf index e9c1d8f..7e0be65 100644 --- a/infrastructure/modules/lambda/variables.tf +++ b/infrastructure/modules/lambda/variables.tf @@ -42,12 +42,6 @@ variable "kms_key_arn" { # tfscaffold variables specific to this module ## -variable "module" { - type = string - description = "The variable encapsulating the name of this module" - default = "lambda" -} - variable "default_tags" { type = map(string) description = "A map of default tags to apply to all taggable resources within the component" diff --git a/infrastructure/modules/s3bucket/README.md b/infrastructure/modules/s3bucket/README.md index 8563dad..cb0a60f 100644 --- a/infrastructure/modules/s3bucket/README.md +++ b/infrastructure/modules/s3bucket/README.md @@ -22,7 +22,6 @@ | [force\_destroy](#input\_force\_destroy) | Boolean to toggle force destroy of bucket. Defaults to true; should be changed in exceptional circumstances | `bool` | `true` | no | | [kms\_key\_arn](#input\_kms\_key\_arn) | ARN of default encryption KMS key for this bucket. If omitted, will use AES256 | `string` | `null` | no | | [lifecycle\_rules](#input\_lifecycle\_rules) | Object representing the lifecycle rules of the bucket | `any` | `[]` | no | -| [module](#input\_module) | The variable encapsulating the name of this module | `string` | `"s3bucket"` | no | | [name](#input\_name) | The variable encapsulating the name of this bucket | `string` | n/a | yes | | [notification\_events](#input\_notification\_events) | Object representing the notification events for the bucket | `any` | `{}` | no | | [object\_ownership](#input\_object\_ownership) | Ownership of objects written to the bucket | `string` | `"BucketOwnerEnforced"` | no | diff --git a/infrastructure/modules/s3bucket/locals.tf b/infrastructure/modules/s3bucket/locals.tf index b2bb5db..18809c7 100644 --- a/infrastructure/modules/s3bucket/locals.tf +++ b/infrastructure/modules/s3bucket/locals.tf @@ -1,16 +1,5 @@ locals { - # Compound Scope Identifier - csi = replace( - format( - "%s-%s-%s-%s", - var.project, - var.environment, - var.component, - var.name, - ), - "_", - "", - ) + module = "s3bucket" # CSI for use in resources with a global namespace, i.e. S3 Buckets csi_global = replace( @@ -24,14 +13,14 @@ locals { var.name, ), "_", - "", + "",s ) default_tags = merge( var.default_tags, { - Module = var.module - Name = var.name + Module = local.module + Name = local.csi_global }, ) diff --git a/infrastructure/modules/s3bucket/variables.tf b/infrastructure/modules/s3bucket/variables.tf index 5d56804..e61fb77 100644 --- a/infrastructure/modules/s3bucket/variables.tf +++ b/infrastructure/modules/s3bucket/variables.tf @@ -31,12 +31,6 @@ variable "region" { # tfscaffold variables specific to this module ## -variable "module" { - type = string - description = "The variable encapsulating the name of this module" - default = "s3bucket" -} - variable "default_tags" { type = map(string) description = "A map of default tags to apply to all taggable resources within the component" diff --git a/infrastructure/modules/sqs/README.md b/infrastructure/modules/sqs/README.md index b3e0a86..e17029c 100644 --- a/infrastructure/modules/sqs/README.md +++ b/infrastructure/modules/sqs/README.md @@ -22,7 +22,6 @@ | [kms\_data\_key\_reuse\_period\_seconds](#input\_kms\_data\_key\_reuse\_period\_seconds) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours) | `number` | `300` | no | | [max\_message\_size](#input\_max\_message\_size) | The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB) | `number` | `262144` | no | | [message\_retention\_seconds](#input\_message\_retention\_seconds) | The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days) | `number` | `null` | no | -| [module](#input\_module) | The variable encapsulating the name of this module | `string` | `"sqs"` | no | | [name](#input\_name) | Name of the SQS Queue | `string` | n/a | yes | | [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes | | [region](#input\_region) | The AWS Region | `string` | n/a | yes | diff --git a/infrastructure/modules/sqs/locals.tf b/infrastructure/modules/sqs/locals.tf index c2549e7..1e7c99c 100644 --- a/infrastructure/modules/sqs/locals.tf +++ b/infrastructure/modules/sqs/locals.tf @@ -1,4 +1,6 @@ locals { + module = "sqs" + # Compound Scope Identifier csi = replace( format( @@ -12,24 +14,10 @@ locals { "", ) - # CSI for use in resources with a global namespace, i.e. S3 Buckets - csi_global = replace( - format( - "%s-%s-%s-%s-%s", - var.project, - var.aws_account_id, - var.region, - var.environment, - var.component, - ), - "_", - "", - ) - default_tags = merge( var.default_tags, { - Module = var.module + Module = local.module Name = local.csi }, ) diff --git a/infrastructure/modules/sqs/variables.tf b/infrastructure/modules/sqs/variables.tf index 5dc18c1..822b688 100644 --- a/infrastructure/modules/sqs/variables.tf +++ b/infrastructure/modules/sqs/variables.tf @@ -31,12 +31,6 @@ variable "region" { # tfscaffold variables specific to this module ## -variable "module" { - type = string - description = "The variable encapsulating the name of this module" - default = "sqs" -} - variable "default_tags" { type = map(string) description = "A map of default tags to apply to all taggable resources within the component"