UPD: added comments

This commit is contained in:
xpk 2022-08-18 08:27:31 +08:00
parent af5909e39b
commit e291845a78
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

View File

@ -1,19 +1,21 @@
# variables.tf
variable "aws-region" {} variable "aws-region" {}
variable "customer-name" {} variable "customer-name" {}
variable "project" {} variable "project" {}
variable "application" {} variable "application" {}
variable "environment" {} variable "environment" {}
# provider.tf
provider "aws" { provider "aws" {
region = var.aws-region region = var.aws-region
default_tags { default_tags {
tags = { tags = {
Environment = var.environment Environment = var.environment
Project = var.project Project = var.project
Application = var.application Application = var.application
TerraformMode = "managed" TerraformMode = "managed"
TerraformDir = path.cwd TerraformDir = path.cwd
BuildDate = formatdate("YYYYMMDD", timestamp()) BuildDate = formatdate("YYYYMMDD", timestamp())
} }
} }
} }
@ -28,13 +30,14 @@ terraform {
} }
} }
# main.tf
locals { locals {
aws-region-short = lookup(module.aws-region-short.region-map, var.aws-region) 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 { module "aws-region-short" {
source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/util/aws-region-short" source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/util/aws-region-short"
} }
module "terraform-state-store" { module "terraform-state-store" {