Skip to content

Commit

Permalink
Terraform format fixes
Browse files Browse the repository at this point in the history
- Adds pre-commit terraform hooks:
  - terraform fmt
  - terraform-docs

Will be automatically run on every commit
  • Loading branch information
egarbi committed Jun 2, 2020
1 parent ad46eb9 commit 2c0e539
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.31.0
hooks:
- id: terraform_fmt
- id: terraform_docs
6 changes: 3 additions & 3 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data "aws_subnet" "default" {
}

data "aws_route53_zone" "selected" {
name = "qndesign.studio"
name = "qndesign.studio"
}

data "aws_region" "current" {}
Expand All @@ -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 = <<CONFIG
{
"Version": "2012-10-17",
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ resource "aws_elasticsearch_domain" "es" {
dedicated_master_count = var.mcount
zone_awareness_enabled = var.zone_awareness
zone_awareness_config {
availability_zone_count = length(var.subnet_ids) > 2 ? 3 : 2
availability_zone_count = length(var.subnet_ids) > 2 ? 3 : 2
}
}

Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}

Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 2c0e539

Please sign in to comment.