Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit affe754

Browse files
fix: remove un-used variables and update linting checks to ensure this is catched in the future
1 parent 9c80ff9 commit affe754

File tree

20 files changed

+60
-105
lines changed

20 files changed

+60
-105
lines changed

‎.pre-commit-config.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.55.0
3+
rev: v1.56.0
44
hooks:
55
- id: terraform_fmt
6+
- id: terraform_validate
67
- id: terraform_docs
78
args:
89
- '--args=--lockfile=false'
9-
- id: terraform_validate
1010
- id: terraform_tflint
11+
args:
12+
- '--args=--only=terraform_deprecated_interpolation'
13+
- '--args=--only=terraform_deprecated_index'
14+
- '--args=--only=terraform_unused_declarations'
15+
- '--args=--only=terraform_comment_syntax'
16+
- '--args=--only=terraform_documented_outputs'
17+
- '--args=--only=terraform_documented_variables'
18+
- '--args=--only=terraform_typed_variables'
19+
- '--args=--only=terraform_module_pinned_source'
20+
- '--args=--only=terraform_naming_convention'
21+
- '--args=--only=terraform_required_version'
22+
- '--args=--only=terraform_required_providers'
23+
- '--args=--only=terraform_standard_module_structure'
24+
- '--args=--only=terraform_workspace_remote'
1125
- repo: https://github.com/pre-commit/pre-commit-hooks
1226
rev: v4.0.1
1327
hooks:

‎README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,17 @@ No modules.
114114

115115
| Name | Description | Type | Default | Required |
116116
|------|-------------|------|---------|:--------:|
117-
| <a name="input_auth"></a> [auth](#input\_auth) | Configuration block(s) with authorization mechanisms to connect to the associated instances or clusters | `map(string)` | `{}` | no |
118117
| <a name="input_auth_scheme"></a> [auth\_scheme](#input\_auth\_scheme) | The type of authentication that the proxy uses for connections from the proxy to the underlying database. One of `SECRETS` | `string` | `"SECRETS"` | no |
119118
| <a name="input_connection_borrow_timeout"></a> [connection\_borrow\_timeout](#input\_connection\_borrow\_timeout) | The number of seconds for a proxy to wait for a connection to become available in the connection pool | `number` | `null` | no |
120119
| <a name="input_create_iam_policy"></a> [create\_iam\_policy](#input\_create\_iam\_policy) | Determines whether an IAM policy is created | `bool` | `true` | no |
121120
| <a name="input_create_iam_role"></a> [create\_iam\_role](#input\_create\_iam\_role) | Determines whether an IAM role is created | `bool` | `true` | no |
122121
| <a name="input_create_proxy"></a> [create\_proxy](#input\_create\_proxy) | Determines whether a proxy and its resources will be created | `bool` | `true` | no |
123122
| <a name="input_db_cluster_identifier"></a> [db\_cluster\_identifier](#input\_db\_cluster\_identifier) | DB cluster identifier | `string` | `""` | no |
124-
| <a name="input_db_host"></a> [db\_host](#input\_db\_host) | The identifier to use for the database endpoint | `string` | `""` | no |
125123
| <a name="input_db_instance_identifier"></a> [db\_instance\_identifier](#input\_db\_instance\_identifier) | DB instance identifier | `string` | `""` | no |
126-
| <a name="input_db_name"></a> [db\_name](#input\_db\_name) | The name of the database | `string` | `""` | no |
127124
| <a name="input_db_proxy_endpoints"></a> [db\_proxy\_endpoints](#input\_db\_proxy\_endpoints) | Map of DB proxy endpoints to create and their attributes (see `aws_db_proxy_endpoint`) | `any` | `{}` | no |
128125
| <a name="input_debug_logging"></a> [debug\_logging](#input\_debug\_logging) | Whether the proxy includes detailed information about SQL statements in its logs | `bool` | `false` | no |
129126
| <a name="input_engine_family"></a> [engine\_family](#input\_engine\_family) | The kind of database engine that the proxy will connect to. Valid values are `MYSQL` or `POSTGRESQL` | `string` | `""` | no |
130127
| <a name="input_iam_auth"></a> [iam\_auth](#input\_iam\_auth) | Whether to require or disallow AWS Identity and Access Management (IAM) authentication for connections to the proxy. One of `DISABLED`, `REQUIRED` | `string` | `"REQUIRED"` | no |
131-
| <a name="input_iam_creation_wait_duration"></a> [iam\_creation\_wait\_duration](#input\_iam\_creation\_wait\_duration) | Time duration delay to wait for IAM resource creation/propagation. For example, 30s for 30 seconds or 5m for 5 minutes. Updating this value by itself will not trigger a delay. | `string` | `"30s"` | no |
132128
| <a name="input_iam_policy_name"></a> [iam\_policy\_name](#input\_iam\_policy\_name) | The name of the role policy. If omitted, Terraform will assign a random, unique name | `string` | `""` | no |
133129
| <a name="input_iam_role_description"></a> [iam\_role\_description](#input\_iam\_role\_description) | The description of the role | `string` | `""` | no |
134130
| <a name="input_iam_role_force_detach_policies"></a> [iam\_role\_force\_detach\_policies](#input\_iam\_role\_force\_detach\_policies) | Specifies to force detaching any policies the role has before destroying it | `bool` | `true` | no |

‎examples/mysql_iam_cluster/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ An EC2 instance configuration has been provided for use in validating the exampl
3232
|------|---------|
3333
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
3434
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.38 |
35+
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |
3536

3637
## Providers
3738

3839
| Name | Version |
3940
|------|---------|
4041
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.38 |
41-
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
42+
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |
4243

4344
## Modules
4445

@@ -59,9 +60,7 @@ An EC2 instance configuration has been provided for use in validating the exampl
5960
| [aws_secretsmanager_secret_version.superuser](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
6061
| [random_password.password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
6162
| [random_pet.users](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
62-
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
6363
| [aws_kms_alias.secretsmanager](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_alias) | data source |
64-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
6564

6665
## Inputs
6766

‎examples/mysql_iam_cluster/main.tf

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,17 @@ provider "aws" {
33
}
44

55
locals {
6-
region = "us-east-1"
7-
name = "example-${replace(basename(path.cwd), "_", "-")}"
8-
9-
db_name = "example"
10-
db_username = random_pet.users.id # using random here due to secrets taking at least 7 days before fully deleting from account
11-
db_password = random_password.password.result
12-
db_proxy_resource_id = element(split(":", module.rds_proxy.proxy_arn), 6)
13-
db_iam_connect_prefix = "arn:aws:rds-db:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:dbuser:${local.db_proxy_resource_id}"
6+
region = "us-east-1"
7+
name = "example-${replace(basename(path.cwd), "_", "-")}"
8+
db_username = random_pet.users.id # using random here due to secrets taking at least 7 days before fully deleting from account
9+
db_password = random_password.password.result
1410

1511
tags = {
1612
Example = local.name
1713
Environment = "dev"
1814
}
1915
}
2016

21-
data "aws_region" "current" {}
22-
23-
data "aws_caller_identity" "current" {}
24-
2517
################################################################################
2618
# Supporting Resources
2719
################################################################################
@@ -72,7 +64,7 @@ module "rds" {
7264
version = "~> 6.0"
7365

7466
name = local.name
75-
database_name = local.db_name
67+
database_name = "example"
7668
master_username = local.db_username
7769
master_password = local.db_password
7870

@@ -213,8 +205,6 @@ module "rds_proxy" {
213205
}
214206

215207
engine_family = "MYSQL"
216-
db_host = module.rds.cluster_endpoint
217-
db_name = module.rds.cluster_database_name
218208
debug_logging = true
219209

220210
# Target Aurora cluster

‎examples/mysql_iam_cluster/variables.tf

Whitespace-only changes.

‎examples/mysql_iam_cluster/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ terraform {
66
source = "hashicorp/aws"
77
version = ">= 3.38"
88
}
9+
random = {
10+
source = "hashicorp/random"
11+
version = ">= 2.0"
12+
}
913
}
1014
}

‎examples/mysql_iam_instance/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ An EC2 instance configuration has been provided for use in validating the exampl
3232
|------|---------|
3333
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
3434
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.38 |
35+
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |
3536

3637
## Providers
3738

3839
| Name | Version |
3940
|------|---------|
4041
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.38 |
41-
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
42+
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |
4243

4344
## Modules
4445

@@ -58,9 +59,7 @@ An EC2 instance configuration has been provided for use in validating the exampl
5859
| [aws_secretsmanager_secret_version.superuser](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
5960
| [random_password.password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
6061
| [random_pet.users](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
61-
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
6262
| [aws_kms_alias.secretsmanager](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_alias) | data source |
63-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
6463

6564
## Inputs
6665

‎examples/mysql_iam_instance/main.tf

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,17 @@ provider "aws" {
33
}
44

55
locals {
6-
region = "us-east-1"
7-
name = "example-${replace(basename(path.cwd), "_", "-")}"
8-
9-
db_name = "example"
10-
db_username = random_pet.users.id # using random here due to secrets taking at least 7 days before fully deleting from account
11-
db_password = random_password.password.result
12-
db_proxy_resource_id = element(split(":", module.rds_proxy.proxy_arn), 6)
13-
db_iam_connect_prefix = "arn:aws:rds-db:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:dbuser:${local.db_proxy_resource_id}"
6+
region = "us-east-1"
7+
name = "example-${replace(basename(path.cwd), "_", "-")}"
8+
db_username = random_pet.users.id # using random here due to secrets taking at least 7 days before fully deleting from account
9+
db_password = random_password.password.result
1410

1511
tags = {
1612
Example = local.name
1713
Environment = "dev"
1814
}
1915
}
2016

21-
data "aws_region" "current" {}
22-
23-
data "aws_caller_identity" "current" {}
24-
2517
################################################################################
2618
# Supporting Resources
2719
################################################################################
@@ -92,7 +84,7 @@ module "rds" {
9284
source = "terraform-aws-modules/rds/aws"
9385
version = "~> 3.0"
9486

95-
name = local.db_name
87+
name = "example"
9688
username = local.db_username
9789
password = local.db_password
9890

@@ -218,8 +210,6 @@ module "rds_proxy" {
218210
}
219211

220212
engine_family = "MYSQL"
221-
db_host = module.rds.db_instance_address
222-
db_name = module.rds.db_instance_name
223213
debug_logging = true
224214

225215
# Target RDS instance

‎examples/mysql_iam_instance/variables.tf

Whitespace-only changes.

‎examples/mysql_iam_instance/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ terraform {
66
source = "hashicorp/aws"
77
version = ">= 3.38"
88
}
9+
random = {
10+
source = "hashicorp/random"
11+
version = ">= 2.0"
12+
}
913
}
1014
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /