From e291845a78044cca7ef23e9a25c872f410df0e1e Mon Sep 17 00:00:00 2001 From: xpk Date: Thu, 18 Aug 2022 08:27:31 +0800 Subject: [PATCH] UPD: added comments --- modules/terraform-setup/examples/main.tf | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/terraform-setup/examples/main.tf b/modules/terraform-setup/examples/main.tf index ec35058..3fd5f6d 100644 --- a/modules/terraform-setup/examples/main.tf +++ b/modules/terraform-setup/examples/main.tf @@ -1,19 +1,21 @@ +# variables.tf variable "aws-region" {} variable "customer-name" {} variable "project" {} variable "application" {} variable "environment" {} +# provider.tf provider "aws" { region = var.aws-region default_tags { tags = { - Environment = var.environment - Project = var.project - Application = var.application + Environment = var.environment + Project = var.project + Application = var.application TerraformMode = "managed" - TerraformDir = path.cwd - BuildDate = formatdate("YYYYMMDD", timestamp()) + TerraformDir = path.cwd + BuildDate = formatdate("YYYYMMDD", timestamp()) } } } @@ -28,13 +30,14 @@ terraform { } } +# main.tf locals { aws-region-short = lookup(module.aws-region-short.region-map, var.aws-region) - resource-prefix = "${var.environment}-${local.aws-region-short}-${var.customer-name}-${var.project}" + resource-prefix = "${var.environment}-${local.aws-region-short}-${var.customer-name}-${var.project}" } -module aws-region-short { - source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/util/aws-region-short" +module "aws-region-short" { + source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/util/aws-region-short" } module "terraform-state-store" {