From e1ca878fa3010ec355ba0f46655afedf62d78d0e Mon Sep 17 00:00:00 2001 From: badra001 Date: Wed, 4 Nov 2020 14:44:15 -0500 Subject: [PATCH] add config to split into submodules --- CHANGELOG.md | 12 ++++++++++++ outputs.tf => common/outputs.tf | 0 prefixes.tf => common/prefixes.tf | 0 main.tf => common/resources.tf | 23 ++++------------------- variables.tf => common/variables.tf | 0 version.tf => common/version.tf | 2 +- standard/main.tf | 18 ++++++++++++++++++ standard/outputs.tf | 1 + standard/prefixes.tf | 1 + standard/resources.tf | 1 + standard/variables.tf | 1 + standard/version.tf | 1 + title26/main.tf | 20 ++++++++++++++++++++ title26/outputs.tf | 1 + title26/prefixes.tf | 1 + title26/resources.tf | 1 + title26/variables.tf | 1 + title26/version.tf | 1 + 18 files changed, 65 insertions(+), 20 deletions(-) rename outputs.tf => common/outputs.tf (100%) rename prefixes.tf => common/prefixes.tf (100%) rename main.tf => common/resources.tf (94%) rename variables.tf => common/variables.tf (100%) rename version.tf => common/version.tf (81%) create mode 100644 standard/main.tf create mode 120000 standard/outputs.tf create mode 120000 standard/prefixes.tf create mode 120000 standard/resources.tf create mode 120000 standard/variables.tf create mode 120000 standard/version.tf create mode 100644 title26/main.tf create mode 120000 title26/outputs.tf create mode 120000 title26/prefixes.tf create mode 120000 title26/resources.tf create mode 120000 title26/variables.tf create mode 120000 title26/version.tf diff --git a/CHANGELOG.md b/CHANGELOG.md index a927279..1f113dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,3 +12,15 @@ * v1.2 -- 20201104 - fix s3 bucket permission to not output statement with deny if no IP and VPCE provided + +* v2.0 -- 20201104 + - change to aws-s3 + - create submodules `standard` and `title26` + - standard + - no versioning + - no explicit boc:authority tag + - auto create encryption key if not provided already + - title26 + - versioning + - explicit boc:authority tag + - auto create encryption key diff --git a/outputs.tf b/common/outputs.tf similarity index 100% rename from outputs.tf rename to common/outputs.tf diff --git a/prefixes.tf b/common/prefixes.tf similarity index 100% rename from prefixes.tf rename to common/prefixes.tf diff --git a/main.tf b/common/resources.tf similarity index 94% rename from main.tf rename to common/resources.tf index 2e882fe..9939827 100644 --- a/main.tf +++ b/common/resources.tf @@ -1,18 +1,3 @@ -/* -* # About aws-t26-s3 -* -* # Usage -* -* ```hcl -* module "mybucket" { -* source = "git@github.e.it.census.gov:terraform-modules/aws-t26-s3.git" -* -* bucket_name = "myt26bucket" -* } -* ``` -* -*/ - locals { name = var.bucket_name bucket_name = format("%s%s", local._prefixes["s3"], var.bucket_name) @@ -34,9 +19,9 @@ locals { s3_bucket_conditions_list = list(local.condition_allowed_cidr, local.condition_allowed_endpoints) s3_bucket_conditions = [for x in local.s3_bucket_conditions_list : x if length(x.values) > 0] - enforced_tags = { - "boc:safeguard" = "title26" - } + # enforced_tags = { + # "boc:safeguard" = "title26" + # } base_tags = { "boc:tf_module_version" = var._module_version "boc:created_by" = "terraform" @@ -61,7 +46,7 @@ resource "aws_s3_bucket" "this" { } versioning { - enabled = true + enabled = local.versioning } logging { diff --git a/variables.tf b/common/variables.tf similarity index 100% rename from variables.tf rename to common/variables.tf diff --git a/version.tf b/common/version.tf similarity index 81% rename from version.tf rename to common/version.tf index e900a45..c2d950a 100644 --- a/version.tf +++ b/common/version.tf @@ -1,5 +1,5 @@ variable "_module_version" { description = "Module version number" type = string - default = "1.2" + default = "2.0" } diff --git a/standard/main.tf b/standard/main.tf new file mode 100644 index 0000000..f460239 --- /dev/null +++ b/standard/main.tf @@ -0,0 +1,18 @@ +/* +* # About aws-s3 +* +* # Usage +* +* ```hcl +* module "mybucket" { +* source = "git@github.e.it.census.gov:terraform-modules/aws-s3//standard" +* +* bucket_name = "mynormalbucket" +* } +* ``` +* +*/ +locals { + enforced_tags = {} + versioning = false +} diff --git a/standard/outputs.tf b/standard/outputs.tf new file mode 120000 index 0000000..93b0065 --- /dev/null +++ b/standard/outputs.tf @@ -0,0 +1 @@ +../common/outputs.tf \ No newline at end of file diff --git a/standard/prefixes.tf b/standard/prefixes.tf new file mode 120000 index 0000000..7e265d5 --- /dev/null +++ b/standard/prefixes.tf @@ -0,0 +1 @@ +../common/prefixes.tf \ No newline at end of file diff --git a/standard/resources.tf b/standard/resources.tf new file mode 120000 index 0000000..6dd8c84 --- /dev/null +++ b/standard/resources.tf @@ -0,0 +1 @@ +../common/resources.tf \ No newline at end of file diff --git a/standard/variables.tf b/standard/variables.tf new file mode 120000 index 0000000..72202b3 --- /dev/null +++ b/standard/variables.tf @@ -0,0 +1 @@ +../common/variables.tf \ No newline at end of file diff --git a/standard/version.tf b/standard/version.tf new file mode 120000 index 0000000..b83c5b7 --- /dev/null +++ b/standard/version.tf @@ -0,0 +1 @@ +../common/version.tf \ No newline at end of file diff --git a/title26/main.tf b/title26/main.tf new file mode 100644 index 0000000..c380fd7 --- /dev/null +++ b/title26/main.tf @@ -0,0 +1,20 @@ +/* +* # About aws-s3 +* +* # Usage +* +* ```hcl +* module "mybucket" { +* source = "git@github.e.it.census.gov:terraform-modules/aws-s3//title26" +* +* bucket_name = "myt26bucket" +* } +* ``` +* +*/ +locals { + enforced_tags = { + "boc:safeguard" = "title26" + } + versioning = true +} diff --git a/title26/outputs.tf b/title26/outputs.tf new file mode 120000 index 0000000..93b0065 --- /dev/null +++ b/title26/outputs.tf @@ -0,0 +1 @@ +../common/outputs.tf \ No newline at end of file diff --git a/title26/prefixes.tf b/title26/prefixes.tf new file mode 120000 index 0000000..7e265d5 --- /dev/null +++ b/title26/prefixes.tf @@ -0,0 +1 @@ +../common/prefixes.tf \ No newline at end of file diff --git a/title26/resources.tf b/title26/resources.tf new file mode 120000 index 0000000..6dd8c84 --- /dev/null +++ b/title26/resources.tf @@ -0,0 +1 @@ +../common/resources.tf \ No newline at end of file diff --git a/title26/variables.tf b/title26/variables.tf new file mode 120000 index 0000000..72202b3 --- /dev/null +++ b/title26/variables.tf @@ -0,0 +1 @@ +../common/variables.tf \ No newline at end of file diff --git a/title26/version.tf b/title26/version.tf new file mode 120000 index 0000000..b83c5b7 --- /dev/null +++ b/title26/version.tf @@ -0,0 +1 @@ +../common/version.tf \ No newline at end of file