From 22a0f0980dde24697c306d5db2f98fda1920efc8 Mon Sep 17 00:00:00 2001 From: xpk Date: Thu, 23 Nov 2023 17:15:34 +0800 Subject: [PATCH] NEW: Skeleton files with provider default tags --- examples/skel/provider.tf | 27 +++++++++++++++++++++++++++ examples/skel/terraform.tfvars | 5 +++++ examples/skel/variables.tf | 5 +++++ 3 files changed, 37 insertions(+) create mode 100644 examples/skel/provider.tf create mode 100644 examples/skel/terraform.tfvars create mode 100644 examples/skel/variables.tf diff --git a/examples/skel/provider.tf b/examples/skel/provider.tf new file mode 100644 index 0000000..9a26d39 --- /dev/null +++ b/examples/skel/provider.tf @@ -0,0 +1,27 @@ +provider "aws" { + region = var.aws-region + default_tags { + tags = { + Environment = var.environment + Project = var.project + Application = var.application + TerraformMode = "managed" + BuildDate = time_static.current_time.rfc3339 + TerraformDir = "${reverse(split("/", path.cwd))[1]}/${reverse(split("/", path.cwd))[0]}" + } + } +} + +resource "time_static" "current_time" {} + +terraform { + required_version = ">= 1.3" + required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 5.0" + } + } +} + + diff --git a/examples/skel/terraform.tfvars b/examples/skel/terraform.tfvars new file mode 100644 index 0000000..ab01a90 --- /dev/null +++ b/examples/skel/terraform.tfvars @@ -0,0 +1,5 @@ +aws-region = "ap-east-1" +customer-name = "CX" +environment = "prod" +project = "SupportTools" +application = "Undefined" diff --git a/examples/skel/variables.tf b/examples/skel/variables.tf new file mode 100644 index 0000000..9233cee --- /dev/null +++ b/examples/skel/variables.tf @@ -0,0 +1,5 @@ +variable "aws-region" {} +variable "customer-name" {} +variable "environment" {} +variable "project" {} +variable "application" {}