From 0db935e66720348583eb190e6d8548bc4ebe2f80 Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Tue, 24 Nov 2020 10:49:59 +0100 Subject: [PATCH] fix: Updated supported Terraform versions (#15) --- .pre-commit-config.yaml | 20 +++++++++++++++++-- examples/cis-alarms/README.md | 5 ++++- examples/cis-alarms/variables.tf | 0 examples/cis-alarms/versions.tf | 7 +++++++ .../README.md | 5 ++++- .../outputs.tf | 1 + .../variables.tf | 0 .../versions.tf | 7 +++++++ .../aws_cloudwatch_log_group/outputs.tf | 9 ++++++--- .../aws_cloudwatch_log_group/variables.tf | 0 .../aws_cloudwatch_log_group/versions.tf | 8 ++++++++ examples/fixtures/aws_kms_key/main.tf | 4 ---- examples/fixtures/aws_kms_key/outputs.tf | 4 ++++ examples/fixtures/aws_kms_key/variables.tf | 0 examples/fixtures/aws_kms_key/versions.tf | 8 ++++++++ .../fixtures/aws_lambda_function/outputs.tf | 9 ++++++--- .../fixtures/aws_lambda_function/variables.tf | 0 .../fixtures/aws_lambda_function/versions.tf | 9 +++++++++ examples/fixtures/aws_sns_topic/main.tf | 8 -------- examples/fixtures/aws_sns_topic/outputs.tf | 9 +++++++++ examples/fixtures/aws_sns_topic/variables.tf | 0 examples/fixtures/aws_sns_topic/versions.tf | 8 ++++++++ examples/lambda-metric-alarm/README.md | 9 ++++++--- examples/lambda-metric-alarm/main.tf | 2 +- examples/lambda-metric-alarm/outputs.tf | 6 ++++-- examples/lambda-metric-alarm/variables.tf | 0 examples/lambda-metric-alarm/versions.tf | 7 +++++++ .../multiple-lambda-metric-alarm/README.md | 9 ++++++--- .../multiple-lambda-metric-alarm/outputs.tf | 6 ++++-- .../multiple-lambda-metric-alarm/variables.tf | 0 .../multiple-lambda-metric-alarm/versions.tf | 7 +++++++ modules/cis-alarms/README.md | 10 +++++++--- modules/cis-alarms/versions.tf | 8 ++++++++ modules/log-metric-filter/README.md | 7 +++++-- modules/log-metric-filter/versions.tf | 7 +++++++ modules/metric-alarm/README.md | 7 +++++-- modules/metric-alarm/versions.tf | 7 +++++++ .../README.md | 7 +++++-- .../versions.tf | 7 +++++++ 39 files changed, 185 insertions(+), 42 deletions(-) create mode 100644 examples/cis-alarms/variables.tf create mode 100644 examples/cis-alarms/versions.tf create mode 100644 examples/complete-log-metric-filter-and-alarm/variables.tf create mode 100644 examples/complete-log-metric-filter-and-alarm/versions.tf create mode 100644 examples/fixtures/aws_cloudwatch_log_group/variables.tf create mode 100644 examples/fixtures/aws_cloudwatch_log_group/versions.tf create mode 100644 examples/fixtures/aws_kms_key/outputs.tf create mode 100644 examples/fixtures/aws_kms_key/variables.tf create mode 100644 examples/fixtures/aws_kms_key/versions.tf create mode 100644 examples/fixtures/aws_lambda_function/variables.tf create mode 100644 examples/fixtures/aws_lambda_function/versions.tf create mode 100644 examples/fixtures/aws_sns_topic/outputs.tf create mode 100644 examples/fixtures/aws_sns_topic/variables.tf create mode 100644 examples/fixtures/aws_sns_topic/versions.tf create mode 100644 examples/lambda-metric-alarm/variables.tf create mode 100644 examples/lambda-metric-alarm/versions.tf create mode 100644 examples/multiple-lambda-metric-alarm/variables.tf create mode 100644 examples/multiple-lambda-metric-alarm/versions.tf create mode 100644 modules/cis-alarms/versions.tf create mode 100644 modules/log-metric-filter/versions.tf create mode 100644 modules/metric-alarm/versions.tf create mode 100644 modules/metric-alarms-by-multiple-dimensions/versions.tf diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0285452..8677870 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,26 @@ repos: - repo: git://github.com/antonbabenko/pre-commit-terraform - rev: v1.27.0 + rev: v1.44.0 hooks: - id: terraform_fmt + - id: terraform_validate - 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 - rev: v2.5.0 + rev: v3.3.0 hooks: - id: check-merge-conflict diff --git a/examples/cis-alarms/README.md b/examples/cis-alarms/README.md index f7acded..bf44122 100644 --- a/examples/cis-alarms/README.md +++ b/examples/cis-alarms/README.md @@ -17,7 +17,10 @@ Note that this example may create resources which cost money. Run `terraform des ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | ## Providers diff --git a/examples/cis-alarms/variables.tf b/examples/cis-alarms/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/cis-alarms/versions.tf b/examples/cis-alarms/versions.tf new file mode 100644 index 0000000..f2dd5c9 --- /dev/null +++ b/examples/cis-alarms/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + } +} diff --git a/examples/complete-log-metric-filter-and-alarm/README.md b/examples/complete-log-metric-filter-and-alarm/README.md index 7d9e18d..1ccb541 100644 --- a/examples/complete-log-metric-filter-and-alarm/README.md +++ b/examples/complete-log-metric-filter-and-alarm/README.md @@ -17,7 +17,10 @@ Note that this example may create resources which cost money. Run `terraform des ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | ## Providers diff --git a/examples/complete-log-metric-filter-and-alarm/outputs.tf b/examples/complete-log-metric-filter-and-alarm/outputs.tf index 6bd1fbc..5f71bb1 100644 --- a/examples/complete-log-metric-filter-and-alarm/outputs.tf +++ b/examples/complete-log-metric-filter-and-alarm/outputs.tf @@ -2,6 +2,7 @@ output "this_cloudwatch_log_metric_filter_id" { description = "The name of the metric filter" value = module.log_metric_filter.this_cloudwatch_log_metric_filter_id } + output "this_cloudwatch_metric_alarm_arn" { description = "The ARN of the Cloudwatch metric alarm" value = module.alarm.this_cloudwatch_metric_alarm_arn diff --git a/examples/complete-log-metric-filter-and-alarm/variables.tf b/examples/complete-log-metric-filter-and-alarm/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/complete-log-metric-filter-and-alarm/versions.tf b/examples/complete-log-metric-filter-and-alarm/versions.tf new file mode 100644 index 0000000..f2dd5c9 --- /dev/null +++ b/examples/complete-log-metric-filter-and-alarm/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + } +} diff --git a/examples/fixtures/aws_cloudwatch_log_group/outputs.tf b/examples/fixtures/aws_cloudwatch_log_group/outputs.tf index e559525..82b77f9 100644 --- a/examples/fixtures/aws_cloudwatch_log_group/outputs.tf +++ b/examples/fixtures/aws_cloudwatch_log_group/outputs.tf @@ -1,11 +1,14 @@ output "random_id" { - value = random_pet.this.id + description = "Id" + value = random_pet.this.id } output "this_cloudwatch_log_group_arn" { - value = aws_cloudwatch_log_group.this.arn + description = "ARN" + value = aws_cloudwatch_log_group.this.arn } output "this_cloudwatch_log_group_name" { - value = aws_cloudwatch_log_group.this.name + description = "Name" + value = aws_cloudwatch_log_group.this.name } diff --git a/examples/fixtures/aws_cloudwatch_log_group/variables.tf b/examples/fixtures/aws_cloudwatch_log_group/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/fixtures/aws_cloudwatch_log_group/versions.tf b/examples/fixtures/aws_cloudwatch_log_group/versions.tf new file mode 100644 index 0000000..02655b2 --- /dev/null +++ b/examples/fixtures/aws_cloudwatch_log_group/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + random = ">= 2.0" + } +} diff --git a/examples/fixtures/aws_kms_key/main.tf b/examples/fixtures/aws_kms_key/main.tf index 4e1babd..203d012 100644 --- a/examples/fixtures/aws_kms_key/main.tf +++ b/examples/fixtures/aws_kms_key/main.tf @@ -6,7 +6,3 @@ resource "aws_kms_key" "this" { description = "fixtures-${random_pet.this.id}" } - -output "this_kms_key_id" { - value = aws_kms_key.this.key_id -} diff --git a/examples/fixtures/aws_kms_key/outputs.tf b/examples/fixtures/aws_kms_key/outputs.tf new file mode 100644 index 0000000..b12f7c9 --- /dev/null +++ b/examples/fixtures/aws_kms_key/outputs.tf @@ -0,0 +1,4 @@ +output "this_kms_key_id" { + description = "Id" + value = aws_kms_key.this.key_id +} diff --git a/examples/fixtures/aws_kms_key/variables.tf b/examples/fixtures/aws_kms_key/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/fixtures/aws_kms_key/versions.tf b/examples/fixtures/aws_kms_key/versions.tf new file mode 100644 index 0000000..02655b2 --- /dev/null +++ b/examples/fixtures/aws_kms_key/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + random = ">= 2.0" + } +} diff --git a/examples/fixtures/aws_lambda_function/outputs.tf b/examples/fixtures/aws_lambda_function/outputs.tf index a83951e..20cddcf 100644 --- a/examples/fixtures/aws_lambda_function/outputs.tf +++ b/examples/fixtures/aws_lambda_function/outputs.tf @@ -1,11 +1,14 @@ output "random_id" { - value = random_pet.this.id + description = "Id" + value = random_pet.this.id } output "this_lambda_function_arn" { - value = aws_lambda_function.this.arn + description = "ARN" + value = aws_lambda_function.this.arn } output "this_lambda_function_name" { - value = aws_lambda_function.this.function_name + description = "Name" + value = aws_lambda_function.this.function_name } diff --git a/examples/fixtures/aws_lambda_function/variables.tf b/examples/fixtures/aws_lambda_function/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/fixtures/aws_lambda_function/versions.tf b/examples/fixtures/aws_lambda_function/versions.tf new file mode 100644 index 0000000..0cc5eb5 --- /dev/null +++ b/examples/fixtures/aws_lambda_function/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + random = ">= 2.0" + archive = ">= 2.0" + } +} diff --git a/examples/fixtures/aws_sns_topic/main.tf b/examples/fixtures/aws_sns_topic/main.tf index eb1a86d..4762a6f 100644 --- a/examples/fixtures/aws_sns_topic/main.tf +++ b/examples/fixtures/aws_sns_topic/main.tf @@ -5,11 +5,3 @@ resource "random_pet" "this" { resource "aws_sns_topic" "this" { name = "fixtures-${random_pet.this.id}" } - -output "this_sns_topic_arn" { - value = aws_sns_topic.this.arn -} - -output "this_sns_topic_name" { - value = aws_sns_topic.this.name -} diff --git a/examples/fixtures/aws_sns_topic/outputs.tf b/examples/fixtures/aws_sns_topic/outputs.tf new file mode 100644 index 0000000..a2e64bd --- /dev/null +++ b/examples/fixtures/aws_sns_topic/outputs.tf @@ -0,0 +1,9 @@ +output "this_sns_topic_arn" { + description = "ARN" + value = aws_sns_topic.this.arn +} + +output "this_sns_topic_name" { + description = "Name" + value = aws_sns_topic.this.name +} diff --git a/examples/fixtures/aws_sns_topic/variables.tf b/examples/fixtures/aws_sns_topic/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/fixtures/aws_sns_topic/versions.tf b/examples/fixtures/aws_sns_topic/versions.tf new file mode 100644 index 0000000..02655b2 --- /dev/null +++ b/examples/fixtures/aws_sns_topic/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + random = ">= 2.0" + } +} diff --git a/examples/lambda-metric-alarm/README.md b/examples/lambda-metric-alarm/README.md index c14aeb1..0998e17 100644 --- a/examples/lambda-metric-alarm/README.md +++ b/examples/lambda-metric-alarm/README.md @@ -17,7 +17,10 @@ Note that this example may create resources which cost money. Run `terraform des ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | ## Providers @@ -33,7 +36,7 @@ No input. |------|-------------| | this\_cloudwatch\_metric\_alarm\_arn | The ARN of the Cloudwatch metric alarm | | this\_cloudwatch\_metric\_alarm\_id | The ID of the Cloudwatch metric alarm | -| this\_lambda\_function1\_arn | n/a | -| this\_lambda\_function1\_name | n/a | +| this\_lambda\_function1\_arn | Lambda function ARN | +| this\_lambda\_function1\_name | Lambda function name | diff --git a/examples/lambda-metric-alarm/main.tf b/examples/lambda-metric-alarm/main.tf index b03ad86..f95617c 100644 --- a/examples/lambda-metric-alarm/main.tf +++ b/examples/lambda-metric-alarm/main.tf @@ -14,7 +14,7 @@ module "aws_sns_topic" { source = "../fixtures/aws_sns_topic" } -// Alarm - "there is at least one error in a minute in AWS Lambda functions" +# Alarm - "there is at least one error in a minute in AWS Lambda functions" module "all_lambdas_errors_alarm" { source = "../../modules/metric-alarm" diff --git a/examples/lambda-metric-alarm/outputs.tf b/examples/lambda-metric-alarm/outputs.tf index 1d3129e..a74ec46 100644 --- a/examples/lambda-metric-alarm/outputs.tf +++ b/examples/lambda-metric-alarm/outputs.tf @@ -9,9 +9,11 @@ output "this_cloudwatch_metric_alarm_id" { } output "this_lambda_function1_arn" { - value = module.aws_lambda_function1.this_lambda_function_arn + description = "Lambda function ARN" + value = module.aws_lambda_function1.this_lambda_function_arn } output "this_lambda_function1_name" { - value = module.aws_lambda_function1.this_lambda_function_name + description = "Lambda function name" + value = module.aws_lambda_function1.this_lambda_function_name } diff --git a/examples/lambda-metric-alarm/variables.tf b/examples/lambda-metric-alarm/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/lambda-metric-alarm/versions.tf b/examples/lambda-metric-alarm/versions.tf new file mode 100644 index 0000000..f2dd5c9 --- /dev/null +++ b/examples/lambda-metric-alarm/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + } +} diff --git a/examples/multiple-lambda-metric-alarm/README.md b/examples/multiple-lambda-metric-alarm/README.md index 919fc26..9fe89fa 100644 --- a/examples/multiple-lambda-metric-alarm/README.md +++ b/examples/multiple-lambda-metric-alarm/README.md @@ -17,7 +17,10 @@ Note that this example may create resources which cost money. Run `terraform des ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | ## Providers @@ -33,7 +36,7 @@ No input. |------|-------------| | this\_cloudwatch\_metric\_alarm\_arns | List of ARN of the Cloudwatch metric alarms | | this\_cloudwatch\_metric\_alarm\_ids | List of ID of the Cloudwatch metric alarms | -| this\_lambda\_function1\_arn | n/a | -| this\_lambda\_function1\_name | n/a | +| this\_lambda\_function1\_arn | Lambda function ARN | +| this\_lambda\_function1\_name | Lambda function name | diff --git a/examples/multiple-lambda-metric-alarm/outputs.tf b/examples/multiple-lambda-metric-alarm/outputs.tf index 63fe8a2..ab6f6d9 100644 --- a/examples/multiple-lambda-metric-alarm/outputs.tf +++ b/examples/multiple-lambda-metric-alarm/outputs.tf @@ -9,9 +9,11 @@ output "this_cloudwatch_metric_alarm_ids" { } output "this_lambda_function1_arn" { - value = module.aws_lambda_function1.this_lambda_function_arn + description = "Lambda function ARN" + value = module.aws_lambda_function1.this_lambda_function_arn } output "this_lambda_function1_name" { - value = module.aws_lambda_function1.this_lambda_function_name + description = "Lambda function name" + value = module.aws_lambda_function1.this_lambda_function_name } diff --git a/examples/multiple-lambda-metric-alarm/variables.tf b/examples/multiple-lambda-metric-alarm/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/multiple-lambda-metric-alarm/versions.tf b/examples/multiple-lambda-metric-alarm/versions.tf new file mode 100644 index 0000000..f2dd5c9 --- /dev/null +++ b/examples/multiple-lambda-metric-alarm/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + } +} diff --git a/modules/cis-alarms/README.md b/modules/cis-alarms/README.md index 3750571..4f02789 100644 --- a/modules/cis-alarms/README.md +++ b/modules/cis-alarms/README.md @@ -5,14 +5,18 @@ Read more about [CIS AWS Foundations Controls](https://docs.aws.amazon.com/secur ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | +| random | >= 2.0 | ## Providers | Name | Version | |------|---------| -| aws | n/a | -| random | n/a | +| aws | >= 2.55 | +| random | >= 2.0 | ## Inputs diff --git a/modules/cis-alarms/versions.tf b/modules/cis-alarms/versions.tf new file mode 100644 index 0000000..02655b2 --- /dev/null +++ b/modules/cis-alarms/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + random = ">= 2.0" + } +} diff --git a/modules/log-metric-filter/README.md b/modules/log-metric-filter/README.md index 8c3a96b..b78f925 100644 --- a/modules/log-metric-filter/README.md +++ b/modules/log-metric-filter/README.md @@ -3,13 +3,16 @@ ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | ## Providers | Name | Version | |------|---------| -| aws | n/a | +| aws | >= 2.55 | ## Inputs diff --git a/modules/log-metric-filter/versions.tf b/modules/log-metric-filter/versions.tf new file mode 100644 index 0000000..f2dd5c9 --- /dev/null +++ b/modules/log-metric-filter/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + } +} diff --git a/modules/metric-alarm/README.md b/modules/metric-alarm/README.md index 90e34b1..dff0bf2 100644 --- a/modules/metric-alarm/README.md +++ b/modules/metric-alarm/README.md @@ -3,13 +3,16 @@ ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | ## Providers | Name | Version | |------|---------| -| aws | n/a | +| aws | >= 2.55 | ## Inputs diff --git a/modules/metric-alarm/versions.tf b/modules/metric-alarm/versions.tf new file mode 100644 index 0000000..f2dd5c9 --- /dev/null +++ b/modules/metric-alarm/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + } +} diff --git a/modules/metric-alarms-by-multiple-dimensions/README.md b/modules/metric-alarms-by-multiple-dimensions/README.md index 35c3a1c..6d6faef 100644 --- a/modules/metric-alarms-by-multiple-dimensions/README.md +++ b/modules/metric-alarms-by-multiple-dimensions/README.md @@ -3,13 +3,16 @@ ## Requirements -No requirements. +| Name | Version | +|------|---------| +| terraform | >= 0.12.6 | +| aws | >= 2.55 | ## Providers | Name | Version | |------|---------| -| aws | n/a | +| aws | >= 2.55 | ## Inputs diff --git a/modules/metric-alarms-by-multiple-dimensions/versions.tf b/modules/metric-alarms-by-multiple-dimensions/versions.tf new file mode 100644 index 0000000..f2dd5c9 --- /dev/null +++ b/modules/metric-alarms-by-multiple-dimensions/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_version = ">= 0.12.6" + + required_providers { + aws = ">= 2.55" + } +}