UPD: removing unnecessary input variables

This commit is contained in:
xpk 2022-08-18 08:23:50 +08:00
parent d359982fb5
commit af5909e39b
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
3 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,4 @@
variable "aws-region" {} variable "aws-region" {}
variable "aws-region-short" {}
variable "customer-name" {} variable "customer-name" {}
variable "project" {} variable "project" {}
variable "application" {} variable "application" {}
@ -30,7 +29,12 @@ terraform {
} }
locals { locals {
resource-prefix = "${var.environment}-${var.aws-region-short}-${var.customer-name}-${var.project}" 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}"
}
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" { module "terraform-state-store" {
@ -38,7 +42,6 @@ module "terraform-state-store" {
enable-bucket-versioning = true enable-bucket-versioning = true
transition-ia-days = 30 transition-ia-days = 30
bucket-acl = "private" bucket-acl = "private"
resource-prefix = local.resource-prefix
ddb-table-name = "${local.resource-prefix}-tflock" ddb-table-name = "${local.resource-prefix}-tflock"
bucket-name = "${local.resource-prefix}-tfstate" bucket-name = "${local.resource-prefix}-tfstate"
} }

View File

@ -85,8 +85,8 @@ resource "aws_s3_bucket_policy" "bucket-policy" {
"Action": "s3:*", "Action": "s3:*",
"Effect": "Allow", "Effect": "Allow",
"Resource": [ "Resource": [
"arn:aws:s3:::${var.resource-prefix}-tfstate/*", "arn:aws:s3:::${var.bucket-name}/*",
"arn:aws:s3:::${var.resource-prefix}-tfstate" "arn:aws:s3:::${var.bucket-name}-tfstate"
], ],
"Principal": { "Principal": {
"AWS": [ "AWS": [

View File

@ -13,4 +13,3 @@ variable "enable-bucket-versioning" {
default = true default = true
} }
variable "bucket-name" {} variable "bucket-name" {}
variable "resource-prefix" {}