diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..0578629 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: +- repo: git://github.com/antonbabenko/pre-commit-terraform + rev: v1.31.0 + hooks: + - id: terraform_fmt + - id: terraform_docs diff --git a/example/main.tf b/example/main.tf index 3231a7c..b707426 100644 --- a/example/main.tf +++ b/example/main.tf @@ -18,7 +18,7 @@ data "aws_subnet" "default" { } data "aws_route53_zone" "selected" { - name = "qndesign.studio" + name = "qndesign.studio" } data "aws_region" "current" {} @@ -30,12 +30,12 @@ module "es-cluster" { name = "example" vpc_id = "${data.aws_vpc.default.id}" - subnet_ids = [ "${data.aws_subnet.default.0.id}", "${data.aws_subnet.default.1.id}" ] + subnet_ids = ["${data.aws_subnet.default.0.id}", "${data.aws_subnet.default.1.id}"] zone_id = "${data.aws_route53_zone.selected.zone_id}" itype = "m4.large.elasticsearch" icount = 2 zone_awareness = true - ingress_allow_cidr_blocks = [ "${data.aws_vpc.default.cidr_block}" ] + ingress_allow_cidr_blocks = ["${data.aws_vpc.default.cidr_block}"] access_policies = < 2 ? 3 : 2 + availability_zone_count = length(var.subnet_ids) > 2 ? 3 : 2 } } @@ -101,7 +101,7 @@ resource "aws_elasticsearch_domain" "es" { # Add ALB record on DNS resource "aws_route53_record" "main" { - count = length(var.zone_id) > 0 ? 1 : 0 + count = length(var.zone_id) > 0 ? 1 : 0 zone_id = var.zone_id name = var.name type = "CNAME" diff --git a/outputs.tf b/outputs.tf index 333b2c5..93d660e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -19,7 +19,7 @@ output "es_endpoint" { } output "es_kibana_endpoint" { - description = "Domain-specific endpoint for kibana without https scheme." + description = "Domain-specific endpoint for kibana without https scheme." value = "${aws_elasticsearch_domain.es.kibana_endpoint}" } diff --git a/variables.tf b/variables.tf index 26e0cd8..3fddf37 100644 --- a/variables.tf +++ b/variables.tf @@ -17,7 +17,7 @@ variable "vpc_id" { // Optional variable "create_iam_service_linked_role" { description = "Control the creation of the default service role, set it to false if you have already created it" - default = true + default = true } variable "zone_id" {