UPD: minor updates

This commit is contained in:
xpk 2022-08-17 16:55:28 +08:00
parent e272c6471a
commit 914c6661fe
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
4 changed files with 60 additions and 6 deletions

View File

@ -3,4 +3,7 @@ Module for creating terraform state bucket and locks.
The output ```provider-config-block``` shows how to configure terraform provider.
Please enable terraform default tags. See https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider
Please enable terraform default tags. See https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider
## Examples
See examples in the examples directory.

View File

@ -0,0 +1,10 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "4.26.0"
constraints = ">= 3.25.0"
hashes = [
"h1:jt8jLpFFhaapdbBqw4WQpDuLN8y7zF8/iLyCzypDxSQ=",
]
}

View File

@ -0,0 +1,44 @@
variable "aws-region" {}
variable "aws-region-short" {}
variable "customer-name" {}
variable "project" {}
variable "application" {}
variable "environment" {}
provider "aws" {
region = var.aws-region
default_tags {
tags = {
Environment = var.environment
Project = var.project
Application = var.application
TerraformMode = "managed"
TerraformDir = path.cwd
BuildDate = formatdate("YYYYMMDD", timestamp())
}
}
}
terraform {
required_version = ">= 0.14"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.25"
}
}
}
locals {
resource-prefix = "${var.environment}-${var.aws-region-short}-${var.customer-name}-${var.project}"
}
module "terraform-state-store" {
source = "git::https://xpk.headdesk.me/git/xpk/terraform.aws-baseline-infra//modules/terraform-setup"
enable-bucket-versioning = true
transition-ia-days = 30
bucket-acl = "private"
resource-prefix = local.resource-prefix
ddb-table-name = "${local.resource-prefix}-tflock"
bucket-name = "${local.resource-prefix}-tfstate"
}

View File

@ -1,6 +1,4 @@
variable resource-prefix {}
variable ddb-table-name {}
variable "ddb-table-name" {}
variable "transition-ia-days" {}
variable "bucket-retain-days" {
default = 0
@ -8,12 +6,11 @@ variable "bucket-retain-days" {
variable "bucket-enable-lifecycle" {
default = true
}
variable "bucket-acl" {
default = "private"
}
variable "enable-bucket-versioning" {
default = true
}
variable "bucket-name" {}
variable "resource-prefix" {}