UPD: minor updates
This commit is contained in:
parent
e272c6471a
commit
914c6661fe
@ -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.
|
||||
|
10
modules/terraform-setup/examples/.terraform.lock.hcl
Normal file
10
modules/terraform-setup/examples/.terraform.lock.hcl
Normal 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=",
|
||||
]
|
||||
}
|
44
modules/terraform-setup/examples/main.tf
Normal file
44
modules/terraform-setup/examples/main.tf
Normal 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"
|
||||
}
|
@ -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" {}
|
Loading…
Reference in New Issue
Block a user