Commit 18e99eed authored by XIAO HANXU's avatar XIAO HANXU Committed by GitHub

fix: Added tflint and fixes in README (#265)

parent d545b5c4
repos: repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform - repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.31.0 rev: v1.43.0
hooks: hooks:
- id: terraform_fmt - id: terraform_fmt
- id: terraform_docs - id: terraform_docs
- id: terraform_tflint
args:
- '--args=--only=terraform_deprecated_interpolation'
- '--args=--only=terraform_deprecated_index'
- '--args=--only=terraform_unused_declarations'
- '--args=--only=terraform_comment_syntax'
- '--args=--only=terraform_documented_outputs'
- '--args=--only=terraform_documented_variables'
- '--args=--only=terraform_typed_variables'
- '--args=--only=terraform_module_pinned_source'
- '--args=--only=terraform_naming_convention'
- '--args=--only=terraform_required_version'
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: git://github.com/pre-commit/pre-commit-hooks - repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0 rev: v3.2.0
hooks: hooks:
- id: check-merge-conflict - id: check-merge-conflict
...@@ -139,8 +139,8 @@ module "db" { ...@@ -139,8 +139,8 @@ module "db" {
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| terraform | >= 0.12.6, < 0.14 | | terraform | >= 0.12.6 |
| aws | >= 2.49, < 4.0 | | aws | >= 2.49 |
## Providers ## Providers
...@@ -175,7 +175,7 @@ No provider. ...@@ -175,7 +175,7 @@ No provider.
| engine\_version | The engine version to use | `string` | n/a | yes | | engine\_version | The engine version to use | `string` | n/a | yes |
| family | The family of the DB parameter group | `string` | `""` | no | | family | The family of the DB parameter group | `string` | `""` | no |
| final\_snapshot\_identifier | The name of your final DB snapshot when this DB instance is deleted. | `string` | `null` | no | | final\_snapshot\_identifier | The name of your final DB snapshot when this DB instance is deleted. | `string` | `null` | no |
| iam\_database\_authentication\_enabled | Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled | `bool` | `false` | no | | iam\_database\_authentication\_enabled | Specifies whether or not the mappings of AWS Identity and Access Management (IAM) accounts to database accounts are enabled | `bool` | `false` | no |
| identifier | The name of the RDS instance, if omitted, Terraform will assign a random, unique identifier | `string` | n/a | yes | | identifier | The name of the RDS instance, if omitted, Terraform will assign a random, unique identifier | `string` | n/a | yes |
| instance\_class | The instance type of the RDS instance | `string` | n/a | yes | | instance\_class | The instance type of the RDS instance | `string` | n/a | yes |
| iops | The amount of provisioned IOPS. Setting this implies a storage\_type of 'io1' | `number` | `0` | no | | iops | The amount of provisioned IOPS. Setting this implies a storage\_type of 'io1' | `number` | `0` | no |
......
...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
output "this_db_instance_address" { output "this_db_instance_address" {
description = "The address of the RDS instance" description = "The address of the RDS instance"
value = "${module.db.this_db_instance_address}" value = module.db.this_db_instance_address
} }
output "this_db_instance_arn" { output "this_db_instance_arn" {
description = "The ARN of the RDS instance" description = "The ARN of the RDS instance"
value = "${module.db.this_db_instance_arn}" value = module.db.this_db_instance_arn
} }
output "this_db_instance_availability_zone" { output "this_db_instance_availability_zone" {
description = "The availability zone of the RDS instance" description = "The availability zone of the RDS instance"
value = "${module.db.this_db_instance_availability_zone}" value = module.db.this_db_instance_availability_zone
} }
output "this_db_instance_endpoint" { output "this_db_instance_endpoint" {
description = "The connection endpoint" description = "The connection endpoint"
value = "${module.db.this_db_instance_endpoint}" value = module.db.this_db_instance_endpoint
} }
output "this_db_instance_hosted_zone_id" { output "this_db_instance_hosted_zone_id" {
description = "The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)" description = "The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)"
value = "${module.db.this_db_instance_hosted_zone_id}" value = module.db.this_db_instance_hosted_zone_id
} }
output "this_db_instance_id" { output "this_db_instance_id" {
description = "The RDS instance ID" description = "The RDS instance ID"
value = "${module.db.this_db_instance_id}" value = module.db.this_db_instance_id
} }
output "this_db_instance_resource_id" { output "this_db_instance_resource_id" {
description = "The RDS Resource ID of this instance" description = "The RDS Resource ID of this instance"
value = "${module.db.this_db_instance_resource_id}" value = module.db.this_db_instance_resource_id
} }
output "this_db_instance_status" { output "this_db_instance_status" {
description = "The RDS instance status" description = "The RDS instance status"
value = "${module.db.this_db_instance_status}" value = module.db.this_db_instance_status
} }
output "this_db_instance_name" { output "this_db_instance_name" {
description = "The database name" description = "The database name"
value = "${module.db.this_db_instance_name}" value = module.db.this_db_instance_name
} }
output "this_db_instance_username" { output "this_db_instance_username" {
description = "The master username for the database" description = "The master username for the database"
value = "${module.db.this_db_instance_username}" value = module.db.this_db_instance_username
} }
output "this_db_instance_password" { output "this_db_instance_password" {
description = "The database password (this password may be old, because Terraform doesn't track it after initial creation)" description = "The database password (this password may be old, because Terraform doesn't track it after initial creation)"
value = "${module.db.this_db_instance_password}" value = module.db.this_db_instance_password
} }
output "this_db_instance_port" { output "this_db_instance_port" {
description = "The database port" description = "The database port"
value = "${module.db.this_db_instance_port}" value = module.db.this_db_instance_port
} }
output "this_db_subnet_group_id" { output "this_db_subnet_group_id" {
description = "The db subnet group name" description = "The db subnet group name"
value = "${module.db.this_db_subnet_group_id}" value = module.db.this_db_subnet_group_id
} }
output "this_db_subnet_group_arn" { output "this_db_subnet_group_arn" {
description = "The ARN of the db subnet group" description = "The ARN of the db subnet group"
value = "${module.db.this_db_subnet_group_arn}" value = module.db.this_db_subnet_group_arn
} }
output "this_db_parameter_group_id" { output "this_db_parameter_group_id" {
description = "The db parameter group id" description = "The db parameter group id"
value = "${module.db.this_db_parameter_group_id}" value = module.db.this_db_parameter_group_id
} }
output "this_db_parameter_group_arn" { output "this_db_parameter_group_arn" {
description = "The ARN of the db parameter group" description = "The ARN of the db parameter group"
value = "${module.db.this_db_parameter_group_arn}" value = module.db.this_db_parameter_group_arn
} }
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -21,13 +21,16 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -21,13 +21,16 @@ Note that this example may create resources which cost money. Run `terraform des
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
...@@ -35,6 +38,23 @@ No input. ...@@ -35,6 +38,23 @@ No input.
## Outputs ## Outputs
No output. | Name | Description |
|------|-------------|
| this\_db\_instance\_address | The address of the RDS instance |
| this\_db\_instance\_arn | The ARN of the RDS instance |
| this\_db\_instance\_availability\_zone | The availability zone of the RDS instance |
| this\_db\_instance\_endpoint | The connection endpoint |
| this\_db\_instance\_hosted\_zone\_id | The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record) |
| this\_db\_instance\_id | The RDS instance ID |
| this\_db\_instance\_name | The database name |
| this\_db\_instance\_password | The database password (this password may be old, because Terraform doesn't track it after initial creation) |
| this\_db\_instance\_port | The database port |
| this\_db\_instance\_resource\_id | The RDS Resource ID of this instance |
| this\_db\_instance\_status | The RDS instance status |
| this\_db\_instance\_username | The master username for the database |
| this\_db\_parameter\_group\_arn | The ARN of the db parameter group |
| this\_db\_parameter\_group\_id | The db parameter group id |
| this\_db\_subnet\_group\_arn | The ARN of the db subnet group |
| this\_db\_subnet\_group\_id | The db subnet group name |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
output "this_db_instance_address" {
description = "The address of the RDS instance"
value = module.db.this_db_instance_address
}
output "this_db_instance_arn" {
description = "The ARN of the RDS instance"
value = module.db.this_db_instance_arn
}
output "this_db_instance_availability_zone" {
description = "The availability zone of the RDS instance"
value = module.db.this_db_instance_availability_zone
}
output "this_db_instance_endpoint" {
description = "The connection endpoint"
value = module.db.this_db_instance_endpoint
}
output "this_db_instance_hosted_zone_id" {
description = "The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)"
value = module.db.this_db_instance_hosted_zone_id
}
output "this_db_instance_id" {
description = "The RDS instance ID"
value = module.db.this_db_instance_id
}
output "this_db_instance_resource_id" {
description = "The RDS Resource ID of this instance"
value = module.db.this_db_instance_resource_id
}
output "this_db_instance_status" {
description = "The RDS instance status"
value = module.db.this_db_instance_status
}
output "this_db_instance_name" {
description = "The database name"
value = module.db.this_db_instance_name
}
output "this_db_instance_username" {
description = "The master username for the database"
value = module.db.this_db_instance_username
}
output "this_db_instance_password" {
description = "The database password (this password may be old, because Terraform doesn't track it after initial creation)"
value = module.db.this_db_instance_password
}
output "this_db_instance_port" {
description = "The database port"
value = module.db.this_db_instance_port
}
output "this_db_subnet_group_id" {
description = "The db subnet group name"
value = module.db.this_db_subnet_group_id
}
output "this_db_subnet_group_arn" {
description = "The ARN of the db subnet group"
value = module.db.this_db_subnet_group_arn
}
output "this_db_parameter_group_id" {
description = "The db parameter group id"
value = module.db.this_db_parameter_group_id
}
output "this_db_parameter_group_arn" {
description = "The ARN of the db parameter group"
value = module.db.this_db_parameter_group_arn
}
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des ...@@ -19,13 +19,16 @@ Note that this example may create resources which cost money. Run `terraform des
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -2,7 +2,6 @@ locals { ...@@ -2,7 +2,6 @@ locals {
db_subnet_group_name = var.db_subnet_group_name != "" ? var.db_subnet_group_name : module.db_subnet_group.this_db_subnet_group_id db_subnet_group_name = var.db_subnet_group_name != "" ? var.db_subnet_group_name : module.db_subnet_group.this_db_subnet_group_id
enable_create_db_subnet_group = var.db_subnet_group_name == "" ? var.create_db_subnet_group : false enable_create_db_subnet_group = var.db_subnet_group_name == "" ? var.create_db_subnet_group : false
parameter_group_name = var.parameter_group_name != "" ? var.parameter_group_name : var.identifier
parameter_group_name_id = var.parameter_group_name != "" ? var.parameter_group_name : module.db_parameter_group.this_db_parameter_group_id parameter_group_name_id = var.parameter_group_name != "" ? var.parameter_group_name : module.db_parameter_group.this_db_parameter_group_id
option_group_name = var.option_group_name != "" ? var.option_group_name : module.db_option_group.this_db_option_group_id option_group_name = var.option_group_name != "" ? var.option_group_name : module.db_option_group.this_db_option_group_id
......
...@@ -3,13 +3,16 @@ ...@@ -3,13 +3,16 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -3,13 +3,16 @@ ...@@ -3,13 +3,16 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -3,13 +3,16 @@ ...@@ -3,13 +3,16 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -3,13 +3,16 @@ ...@@ -3,13 +3,16 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
No requirements. | Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.49 |
## Providers ## Providers
| Name | Version | | Name | Version |
|------|---------| |------|---------|
| aws | n/a | | aws | >= 2.49 |
## Inputs ## Inputs
......
terraform {
required_version = ">= 0.12.6"
required_providers {
aws = ">= 2.49"
}
}
...@@ -45,7 +45,7 @@ variable "license_model" { ...@@ -45,7 +45,7 @@ variable "license_model" {
} }
variable "iam_database_authentication_enabled" { variable "iam_database_authentication_enabled" {
description = "Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled" description = "Specifies whether or not the mappings of AWS Identity and Access Management (IAM) accounts to database accounts are enabled"
type = bool type = bool
default = false default = false
} }
......
terraform { terraform {
required_version = ">= 0.12.6, < 0.14" required_version = ">= 0.12.6"
required_providers { required_providers {
aws = ">= 2.49, < 4.0" aws = ">= 2.49"
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment