generated from terraform-modules/template_aws_submodules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add checks and inputs for business, application, and environment
- Loading branch information
Showing
5 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| locals { | ||
| base_variables = { | ||
| business = var.business | ||
| application = var.application | ||
| environment = var.environment | ||
| custom = var.custom | ||
| } | ||
| base = { for k in ["business", "application", "environment", "custom"] : k => try(local.base_in.base[k], try(var.base_variables[k], null)) } | ||
| } | ||
|
|
||
| resource "terraform_data" "base_environment" { | ||
| count = length(local.base.environment) > 0 ? 1 : 0 | ||
| input = tolist(local.base.environment) | ||
|
|
||
| lifecycle { | ||
| precondition { | ||
| condition = contains(["dev", "test", "qa", "uat", "ite", "stage", "prod", "cre", "sa", "services", "common"], local.base.environment) || local.base.environment == null | ||
| error_message = "The var.environment or base.environment value invalid. See https://github.e.it.census.gov/terraform/cloud-information/tree/master/aws/documentation/naming-tagging-standard for valid list." | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| locals { | ||
| base_in = var.filename != null && try(fileexists(var.filename), false) ? yamldecode(file(var.filename)) : yamldecode("{}") | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| locals { | ||
| _module_version = "0.3.0" | ||
| _module_version = "0.3.1" | ||
| _module_name = "boc-nts" | ||
| } |