Skip to content

Commit

Permalink
Renamed count to created in submodules (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbabenko authored Mar 6, 2018
1 parent f3dfb61 commit 2f379b9
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 13 deletions.
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# EditorConfig is awesome: http://EditorConfig.org
# Uses editorconfig to maintain consistent coding styles

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.{tf,tfvars}]
indent_size = 2
indent_style = space

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[Makefile]
tab_width = 2
indent_style = tab

[COMMIT_EDITMSG]
max_line_length = 0
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
sha: v1.5.0
hooks:
- id: terraform_fmt
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: v1.2.0
hooks:
- id: check-merge-conflict
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ locals {
module "db_subnet_group" {
source = "./modules/db_subnet_group"

count = "${local.enable_create_db_subnet_group}"
create = "${local.enable_create_db_subnet_group}"
identifier = "${var.identifier}"
name_prefix = "${var.identifier}-"
subnet_ids = ["${var.subnet_ids}"]
Expand All @@ -23,7 +23,7 @@ module "db_subnet_group" {
module "db_parameter_group" {
source = "./modules/db_parameter_group"

count = "${var.create_db_parameter_group}"
create = "${var.create_db_parameter_group}"
identifier = "${var.identifier}"
name_prefix = "${var.identifier}-"
family = "${var.family}"
Expand All @@ -39,7 +39,7 @@ module "db_parameter_group" {
module "db_instance" {
source = "./modules/db_instance"

count = "${var.create_db_instance}"
create = "${var.create_db_instance}"
identifier = "${var.identifier}"
engine = "${var.engine}"
engine_version = "${var.engine_version}"
Expand Down
2 changes: 1 addition & 1 deletion modules/db_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ resource "aws_iam_role_policy_attachment" "enhanced_monitoring" {
}

resource "aws_db_instance" "this" {
count = "${var.count ? 1 : 0}"
count = "${var.create ? 1 : 0}"

identifier = "${var.identifier}"

Expand Down
4 changes: 2 additions & 2 deletions modules/db_instance/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "count" {
variable "create" {
description = "Whether to create this resource or not?"
default = 1
default = true
}

variable "identifier" {
Expand Down
2 changes: 1 addition & 1 deletion modules/db_parameter_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# DB parameter group
#####################
resource "aws_db_parameter_group" "this" {
count = "${var.count ? 1 : 0}"
count = "${var.create ? 1 : 0}"

name_prefix = "${var.name_prefix}"
description = "Database parameter group for ${var.identifier}"
Expand Down
4 changes: 2 additions & 2 deletions modules/db_parameter_group/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "count" {
variable "create" {
description = "Whether to create this resource or not?"
default = 1
default = true
}

variable "name_prefix" {
Expand Down
2 changes: 1 addition & 1 deletion modules/db_subnet_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# DB subnet group
##################
resource "aws_db_subnet_group" "this" {
count = "${var.count ? 1 : 0}"
count = "${var.create ? 1 : 0}"

name_prefix = "${var.name_prefix}"
description = "Database subnet group for ${var.identifier}"
Expand Down
4 changes: 2 additions & 2 deletions modules/db_subnet_group/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "count" {
variable "create" {
description = "Whether to create this resource or not?"
default = 1
default = true
}

variable "name_prefix" {
Expand Down
1 change: 0 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,3 @@ variable "create_db_instance" {
description = "Whether to create a database instance"
default = true
}

0 comments on commit 2f379b9

Please sign in to comment.