From 9988d0d15e25381eeb19a6f3dedd26efe6ddc4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20W=C3=BCrbach?= Date: Fri, 22 Dec 2023 14:35:59 +0100 Subject: [PATCH] chore: lint using tflint --- .github/workflows/ci.yaml | 7 +++++++ .tflint.hcl | 10 ++++++++++ Makefile | 14 ++++++++++++++ examples/redis/README.md | 4 +++- examples/redis/main.tf | 1 + examples/redis/providers.tf | 5 ++++- examples/sqs/README.md | 8 ++++++-- examples/sqs/main.tf | 9 --------- examples/sqs/providers.tf | 5 ++++- examples/sqs/terraform.tfvars.example | 1 - .../iam-policy/ecr-create-repository/README.md | 8 ++++++-- .../iam-policy/ecr-create-repository/providers.tf | 5 ++++- .../ecr-create-repository/terraform.tfvars.example | 1 - .../iam-policy/ecr-create-repository/variables.tf | 4 ---- .../iam-policy/s3-admin/README.md | 8 ++++++-- .../iam-policy/s3-admin/providers.tf | 5 ++++- .../iam-policy/s3-admin/terraform.tfvars.example | 1 - .../iam-policy/s3-admin/variables.tf | 4 ---- .../iam-policy/sqs-admin/README.md | 8 ++++++-- .../iam-policy/sqs-admin/providers.tf | 5 ++++- .../iam-policy/sqs-admin/terraform.tfvars.example | 1 - .../iam-policy/sqs-admin/variables.tf | 4 ---- .../iam-role/service-account/README.md | 8 ++++++-- .../iam-role/service-account/providers.tf | 5 ++++- .../service-account/terraform.tfvars.example | 1 - .../iam-role/service-account/variables.tf | 4 ---- .../k8s/service-account/README.md | 7 ++++++- .../k8s/service-account/providers.tf | 5 ++++- .../k8s/service-account/variables.tf | 1 + humanitec-resource-defs/redis/basic/README.md | 7 ++++++- humanitec-resource-defs/redis/basic/providers.tf | 5 ++++- humanitec-resource-defs/s3/basic/README.md | 8 ++++++-- humanitec-resource-defs/s3/basic/providers.tf | 5 ++++- .../s3/basic/terraform.tfvars.example | 1 - humanitec-resource-defs/s3/basic/variables.tf | 4 ---- humanitec-resource-defs/sqs/basic/README.md | 8 ++++++-- humanitec-resource-defs/sqs/basic/providers.tf | 5 ++++- .../sqs/basic/terraform.tfvars.example | 1 - humanitec-resource-defs/sqs/basic/variables.tf | 4 ---- .../workload/service-account/README.md | 7 ++++++- .../workload/service-account/providers.tf | 5 ++++- .../workload/service-account/variables.tf | 1 + modules/iam-role/service-account/README.md | 1 - modules/iam-role/service-account/main.tf | 4 +--- modules/redis/basic/README.md | 1 - modules/redis/basic/main.tf | 2 +- modules/redis/basic/terraform.tfvars.example | 5 ++--- modules/redis/basic/variables.tf | 5 ----- modules/sqs/basic/README.md | 2 +- modules/sqs/basic/main.tf | 3 ++- 50 files changed, 148 insertions(+), 85 deletions(-) create mode 100644 .tflint.hcl diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7992f7e..5159c06 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,3 +37,10 @@ jobs: - name: Terraform Validate run: make validate + + - uses: terraform-linters/setup-tflint@v4 + with: + tflint_version: v0.49.0 + + - name: Lint + run: make lint diff --git a/.tflint.hcl b/.tflint.hcl new file mode 100644 index 0000000..c802daf --- /dev/null +++ b/.tflint.hcl @@ -0,0 +1,10 @@ +plugin "terraform" { + enabled = true + preset = "recommended" +} + +plugin "aws" { + enabled = true + version = "0.28.0" + source = "github.com/terraform-linters/tflint-ruleset-aws" +} diff --git a/Makefile b/Makefile index 2a47904..de63786 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ TF_DIRS = $(patsubst %/main.tf, %, $(shell find . -type d -name .terraform -prune -o -name 'main.tf' -print)) VALIDATE_TF_DIRS = $(addprefix validate-,$(TF_DIRS)) +LINT_TF_DIRS = $(addprefix lint-,$(TF_DIRS)) DOCS_TF_DIRS = $(addprefix docs-,$(TF_DIRS)) @@ -31,3 +32,16 @@ $(VALIDATE_TF_DIRS): validate-%: # Validate all terraform directories validate: $(VALIDATE_TF_DIRS) @echo "All validated" + +# Lint a terraform directories +$(LINT_TF_DIRS): lint-%: + @echo "Lint $*" + tflint --config "$(PWD)/.tflint.hcl" --chdir="$*" + +# Initialize tflint +lint-init: + tflint --init + +# Lint all terraform directories +lint: lint-init $(LINT_TF_DIRS) + @echo "All linted" diff --git a/examples/redis/README.md b/examples/redis/README.md index ea54d0c..78b294a 100644 --- a/examples/redis/README.md +++ b/examples/redis/README.md @@ -3,14 +3,16 @@ | Name | Version | |------|---------| +| terraform | >= 1.3.0 | | aws | ~> 5.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| | aws | ~> 5.0 | -| humanitec | n/a | +| humanitec | ~> 0 | ## Modules diff --git a/examples/redis/main.tf b/examples/redis/main.tf index 5279bc6..66cbe20 100644 --- a/examples/redis/main.tf +++ b/examples/redis/main.tf @@ -36,6 +36,7 @@ module "redis" { access_key = var.access_key secret_key = var.secret_key + resource_packs_aws_url = var.resource_packs_aws_url resource_packs_aws_rev = var.resource_packs_aws_rev region = var.region diff --git a/examples/redis/providers.tf b/examples/redis/providers.tf index c044e13..7f51f89 100644 --- a/examples/redis/providers.tf +++ b/examples/redis/providers.tf @@ -5,9 +5,12 @@ terraform { version = "~> 5.0" } humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } provider "aws" { diff --git a/examples/sqs/README.md b/examples/sqs/README.md index 71f211e..6c866a5 100644 --- a/examples/sqs/README.md +++ b/examples/sqs/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Modules @@ -37,7 +42,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_key | n/a | `string` | n/a | yes | -| humanitec\_organization | n/a | `string` | n/a | yes | | oidc\_provider | n/a | `string` | n/a | yes | | oidc\_provider\_arn | n/a | `string` | n/a | yes | | secret\_key | n/a | `string` | n/a | yes | diff --git a/examples/sqs/main.tf b/examples/sqs/main.tf index cff60c3..15f07c5 100644 --- a/examples/sqs/main.tf +++ b/examples/sqs/main.tf @@ -10,10 +10,6 @@ variable "region" { default = "eu-central-1" } -variable "humanitec_organization" { - type = string -} - variable "resource_packs_aws_rev" { type = string default = "refs/heads/main" @@ -65,7 +61,6 @@ module "s3_basic" { access_key = var.access_key secret_key = var.secret_key resource_packs_aws_rev = var.resource_packs_aws_rev - humanitec_organization = var.humanitec_organization region = var.region policy_classes = [local.s3_admin_policy_class] @@ -84,7 +79,6 @@ module "iam_policy_s3_admin" { access_key = var.access_key secret_key = var.secret_key resource_packs_aws_rev = var.resource_packs_aws_rev - humanitec_organization = var.humanitec_organization region = var.region prefix = local.res_def_prefix @@ -110,7 +104,6 @@ module "sqs_basic" { access_key = var.access_key secret_key = var.secret_key resource_packs_aws_rev = var.resource_packs_aws_rev - humanitec_organization = var.humanitec_organization region = var.region policy_classes = [local.sqs_admin_policy_class] @@ -129,7 +122,6 @@ module "iam_policy_sqs_admin" { access_key = var.access_key secret_key = var.secret_key resource_packs_aws_rev = var.resource_packs_aws_rev - humanitec_organization = var.humanitec_organization region = var.region prefix = local.res_def_prefix @@ -148,7 +140,6 @@ module "iam_role_service_account" { access_key = var.access_key secret_key = var.secret_key resource_packs_aws_rev = var.resource_packs_aws_rev - humanitec_organization = var.humanitec_organization region = var.region oidc_provider = var.oidc_provider diff --git a/examples/sqs/providers.tf b/examples/sqs/providers.tf index 730bfc3..2f2107a 100644 --- a/examples/sqs/providers.tf +++ b/examples/sqs/providers.tf @@ -1,9 +1,12 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/examples/sqs/terraform.tfvars.example b/examples/sqs/terraform.tfvars.example index 1a94e4d..05ea2d4 100644 --- a/examples/sqs/terraform.tfvars.example +++ b/examples/sqs/terraform.tfvars.example @@ -1,5 +1,4 @@ access_key = "" -humanitec_organization = "" name = "item-list" oidc_provider = "" oidc_provider_arn = "" diff --git a/humanitec-resource-defs/iam-policy/ecr-create-repository/README.md b/humanitec-resource-defs/iam-policy/ecr-create-repository/README.md index 3fe2344..8c014e6 100644 --- a/humanitec-resource-defs/iam-policy/ecr-create-repository/README.md +++ b/humanitec-resource-defs/iam-policy/ecr-create-repository/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources @@ -18,7 +23,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_key | n/a | `string` | n/a | yes | -| humanitec\_organization | n/a | `string` | n/a | yes | | prefix | n/a | `string` | n/a | yes | | region | n/a | `string` | n/a | yes | | resource\_packs\_aws\_rev | n/a | `string` | n/a | yes | diff --git a/humanitec-resource-defs/iam-policy/ecr-create-repository/providers.tf b/humanitec-resource-defs/iam-policy/ecr-create-repository/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/iam-policy/ecr-create-repository/providers.tf +++ b/humanitec-resource-defs/iam-policy/ecr-create-repository/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/iam-policy/ecr-create-repository/terraform.tfvars.example b/humanitec-resource-defs/iam-policy/ecr-create-repository/terraform.tfvars.example index 01c4949..5206eeb 100644 --- a/humanitec-resource-defs/iam-policy/ecr-create-repository/terraform.tfvars.example +++ b/humanitec-resource-defs/iam-policy/ecr-create-repository/terraform.tfvars.example @@ -1,5 +1,4 @@ access_key = "" -humanitec_organization = "" prefix = "" region = "" resource_packs_aws_rev = "" diff --git a/humanitec-resource-defs/iam-policy/ecr-create-repository/variables.tf b/humanitec-resource-defs/iam-policy/ecr-create-repository/variables.tf index e0c9295..2399540 100644 --- a/humanitec-resource-defs/iam-policy/ecr-create-repository/variables.tf +++ b/humanitec-resource-defs/iam-policy/ecr-create-repository/variables.tf @@ -1,7 +1,3 @@ -variable "humanitec_organization" { - type = string -} - variable "prefix" { type = string } diff --git a/humanitec-resource-defs/iam-policy/s3-admin/README.md b/humanitec-resource-defs/iam-policy/s3-admin/README.md index 9337a40..838fbe2 100644 --- a/humanitec-resource-defs/iam-policy/s3-admin/README.md +++ b/humanitec-resource-defs/iam-policy/s3-admin/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources @@ -18,7 +23,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_key | n/a | `string` | n/a | yes | -| humanitec\_organization | n/a | `string` | n/a | yes | | prefix | n/a | `string` | n/a | yes | | region | n/a | `string` | n/a | yes | | resource\_packs\_aws\_rev | n/a | `string` | n/a | yes | diff --git a/humanitec-resource-defs/iam-policy/s3-admin/providers.tf b/humanitec-resource-defs/iam-policy/s3-admin/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/iam-policy/s3-admin/providers.tf +++ b/humanitec-resource-defs/iam-policy/s3-admin/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/iam-policy/s3-admin/terraform.tfvars.example b/humanitec-resource-defs/iam-policy/s3-admin/terraform.tfvars.example index 7a4c6aa..60ed9a8 100644 --- a/humanitec-resource-defs/iam-policy/s3-admin/terraform.tfvars.example +++ b/humanitec-resource-defs/iam-policy/s3-admin/terraform.tfvars.example @@ -1,5 +1,4 @@ access_key = "" -humanitec_organization = "" prefix = "" region = "" resource_packs_aws_rev = "" diff --git a/humanitec-resource-defs/iam-policy/s3-admin/variables.tf b/humanitec-resource-defs/iam-policy/s3-admin/variables.tf index cfb65c8..1c68d38 100644 --- a/humanitec-resource-defs/iam-policy/s3-admin/variables.tf +++ b/humanitec-resource-defs/iam-policy/s3-admin/variables.tf @@ -1,7 +1,3 @@ -variable "humanitec_organization" { - type = string -} - variable "prefix" { type = string } diff --git a/humanitec-resource-defs/iam-policy/sqs-admin/README.md b/humanitec-resource-defs/iam-policy/sqs-admin/README.md index 0586289..084c9a4 100644 --- a/humanitec-resource-defs/iam-policy/sqs-admin/README.md +++ b/humanitec-resource-defs/iam-policy/sqs-admin/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources @@ -18,7 +23,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_key | n/a | `string` | n/a | yes | -| humanitec\_organization | n/a | `string` | n/a | yes | | prefix | n/a | `string` | n/a | yes | | region | n/a | `string` | n/a | yes | | resource\_packs\_aws\_rev | n/a | `string` | n/a | yes | diff --git a/humanitec-resource-defs/iam-policy/sqs-admin/providers.tf b/humanitec-resource-defs/iam-policy/sqs-admin/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/iam-policy/sqs-admin/providers.tf +++ b/humanitec-resource-defs/iam-policy/sqs-admin/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/iam-policy/sqs-admin/terraform.tfvars.example b/humanitec-resource-defs/iam-policy/sqs-admin/terraform.tfvars.example index 4334e78..fe1b427 100644 --- a/humanitec-resource-defs/iam-policy/sqs-admin/terraform.tfvars.example +++ b/humanitec-resource-defs/iam-policy/sqs-admin/terraform.tfvars.example @@ -1,5 +1,4 @@ access_key = "" -humanitec_organization = "" prefix = "" region = "" resource_packs_aws_rev = "" diff --git a/humanitec-resource-defs/iam-policy/sqs-admin/variables.tf b/humanitec-resource-defs/iam-policy/sqs-admin/variables.tf index f2a3c4b..b55a237 100644 --- a/humanitec-resource-defs/iam-policy/sqs-admin/variables.tf +++ b/humanitec-resource-defs/iam-policy/sqs-admin/variables.tf @@ -1,7 +1,3 @@ -variable "humanitec_organization" { - type = string -} - variable "prefix" { type = string } diff --git a/humanitec-resource-defs/iam-role/service-account/README.md b/humanitec-resource-defs/iam-role/service-account/README.md index f880ff7..fb710ef 100644 --- a/humanitec-resource-defs/iam-role/service-account/README.md +++ b/humanitec-resource-defs/iam-role/service-account/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources @@ -18,7 +23,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_key | n/a | `string` | n/a | yes | -| humanitec\_organization | n/a | `string` | n/a | yes | | oidc\_provider | n/a | `string` | n/a | yes | | oidc\_provider\_arn | n/a | `string` | n/a | yes | | policy\_classes | n/a | `list(string)` | n/a | yes | diff --git a/humanitec-resource-defs/iam-role/service-account/providers.tf b/humanitec-resource-defs/iam-role/service-account/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/iam-role/service-account/providers.tf +++ b/humanitec-resource-defs/iam-role/service-account/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/iam-role/service-account/terraform.tfvars.example b/humanitec-resource-defs/iam-role/service-account/terraform.tfvars.example index 74e12f9..d3b19d6 100644 --- a/humanitec-resource-defs/iam-role/service-account/terraform.tfvars.example +++ b/humanitec-resource-defs/iam-role/service-account/terraform.tfvars.example @@ -1,5 +1,4 @@ access_key = "" -humanitec_organization = "" oidc_provider = "" oidc_provider_arn = "" policy_classes = "" diff --git a/humanitec-resource-defs/iam-role/service-account/variables.tf b/humanitec-resource-defs/iam-role/service-account/variables.tf index 76073b8..ec26ba0 100644 --- a/humanitec-resource-defs/iam-role/service-account/variables.tf +++ b/humanitec-resource-defs/iam-role/service-account/variables.tf @@ -1,7 +1,3 @@ -variable "humanitec_organization" { - type = string -} - variable "prefix" { type = string } diff --git a/humanitec-resource-defs/k8s/service-account/README.md b/humanitec-resource-defs/k8s/service-account/README.md index 245f109..74b4bf1 100644 --- a/humanitec-resource-defs/k8s/service-account/README.md +++ b/humanitec-resource-defs/k8s/service-account/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources diff --git a/humanitec-resource-defs/k8s/service-account/providers.tf b/humanitec-resource-defs/k8s/service-account/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/k8s/service-account/providers.tf +++ b/humanitec-resource-defs/k8s/service-account/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/k8s/service-account/variables.tf b/humanitec-resource-defs/k8s/service-account/variables.tf index 30c4de2..196ab7d 100644 --- a/humanitec-resource-defs/k8s/service-account/variables.tf +++ b/humanitec-resource-defs/k8s/service-account/variables.tf @@ -1,3 +1,4 @@ variable "prefix" { + type = string default = "" } diff --git a/humanitec-resource-defs/redis/basic/README.md b/humanitec-resource-defs/redis/basic/README.md index 35b0476..4c831cb 100644 --- a/humanitec-resource-defs/redis/basic/README.md +++ b/humanitec-resource-defs/redis/basic/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources diff --git a/humanitec-resource-defs/redis/basic/providers.tf b/humanitec-resource-defs/redis/basic/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/redis/basic/providers.tf +++ b/humanitec-resource-defs/redis/basic/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/s3/basic/README.md b/humanitec-resource-defs/s3/basic/README.md index 6e22a81..f182ef4 100644 --- a/humanitec-resource-defs/s3/basic/README.md +++ b/humanitec-resource-defs/s3/basic/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources @@ -18,7 +23,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_key | n/a | `string` | n/a | yes | -| humanitec\_organization | n/a | `string` | n/a | yes | | policy\_classes | n/a | `list(string)` | n/a | yes | | prefix | n/a | `string` | n/a | yes | | region | n/a | `string` | n/a | yes | diff --git a/humanitec-resource-defs/s3/basic/providers.tf b/humanitec-resource-defs/s3/basic/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/s3/basic/providers.tf +++ b/humanitec-resource-defs/s3/basic/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/s3/basic/terraform.tfvars.example b/humanitec-resource-defs/s3/basic/terraform.tfvars.example index dc41053..29b3cfe 100644 --- a/humanitec-resource-defs/s3/basic/terraform.tfvars.example +++ b/humanitec-resource-defs/s3/basic/terraform.tfvars.example @@ -1,5 +1,4 @@ access_key = "" -humanitec_organization = "" policy_classes = "" prefix = "" region = "" diff --git a/humanitec-resource-defs/s3/basic/variables.tf b/humanitec-resource-defs/s3/basic/variables.tf index fb23e15..117ecc4 100644 --- a/humanitec-resource-defs/s3/basic/variables.tf +++ b/humanitec-resource-defs/s3/basic/variables.tf @@ -1,7 +1,3 @@ -variable "humanitec_organization" { - type = string -} - variable "prefix" { type = string } diff --git a/humanitec-resource-defs/sqs/basic/README.md b/humanitec-resource-defs/sqs/basic/README.md index 6e22a81..f182ef4 100644 --- a/humanitec-resource-defs/sqs/basic/README.md +++ b/humanitec-resource-defs/sqs/basic/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources @@ -18,7 +23,6 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | access\_key | n/a | `string` | n/a | yes | -| humanitec\_organization | n/a | `string` | n/a | yes | | policy\_classes | n/a | `list(string)` | n/a | yes | | prefix | n/a | `string` | n/a | yes | | region | n/a | `string` | n/a | yes | diff --git a/humanitec-resource-defs/sqs/basic/providers.tf b/humanitec-resource-defs/sqs/basic/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/sqs/basic/providers.tf +++ b/humanitec-resource-defs/sqs/basic/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/sqs/basic/terraform.tfvars.example b/humanitec-resource-defs/sqs/basic/terraform.tfvars.example index dc41053..29b3cfe 100644 --- a/humanitec-resource-defs/sqs/basic/terraform.tfvars.example +++ b/humanitec-resource-defs/sqs/basic/terraform.tfvars.example @@ -1,5 +1,4 @@ access_key = "" -humanitec_organization = "" policy_classes = "" prefix = "" region = "" diff --git a/humanitec-resource-defs/sqs/basic/variables.tf b/humanitec-resource-defs/sqs/basic/variables.tf index fb23e15..117ecc4 100644 --- a/humanitec-resource-defs/sqs/basic/variables.tf +++ b/humanitec-resource-defs/sqs/basic/variables.tf @@ -1,7 +1,3 @@ -variable "humanitec_organization" { - type = string -} - variable "prefix" { type = string } diff --git a/humanitec-resource-defs/workload/service-account/README.md b/humanitec-resource-defs/workload/service-account/README.md index 245f109..74b4bf1 100644 --- a/humanitec-resource-defs/workload/service-account/README.md +++ b/humanitec-resource-defs/workload/service-account/README.md @@ -1,11 +1,16 @@ +## Requirements +| Name | Version | +|------|---------| +| terraform | >= 1.3.0 | +| humanitec | ~> 0 | ## Providers | Name | Version | |------|---------| -| humanitec | n/a | +| humanitec | ~> 0 | ## Resources diff --git a/humanitec-resource-defs/workload/service-account/providers.tf b/humanitec-resource-defs/workload/service-account/providers.tf index 5cd4350..86c4fc3 100644 --- a/humanitec-resource-defs/workload/service-account/providers.tf +++ b/humanitec-resource-defs/workload/service-account/providers.tf @@ -1,7 +1,10 @@ terraform { required_providers { humanitec = { - source = "humanitec/humanitec" + source = "humanitec/humanitec" + version = "~> 0" } } + + required_version = ">= 1.3.0" } diff --git a/humanitec-resource-defs/workload/service-account/variables.tf b/humanitec-resource-defs/workload/service-account/variables.tf index 30c4de2..196ab7d 100644 --- a/humanitec-resource-defs/workload/service-account/variables.tf +++ b/humanitec-resource-defs/workload/service-account/variables.tf @@ -1,3 +1,4 @@ variable "prefix" { + type = string default = "" } diff --git a/modules/iam-role/service-account/README.md b/modules/iam-role/service-account/README.md index cefd925..be308ff 100644 --- a/modules/iam-role/service-account/README.md +++ b/modules/iam-role/service-account/README.md @@ -18,7 +18,6 @@ |------|------| | [aws_iam_role.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | | [aws_iam_role_policy_attachment.policies](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | -| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | ## Inputs diff --git a/modules/iam-role/service-account/main.tf b/modules/iam-role/service-account/main.tf index 59ee793..1c734a8 100644 --- a/modules/iam-role/service-account/main.tf +++ b/modules/iam-role/service-account/main.tf @@ -2,8 +2,6 @@ locals { k8s_service_account_name = "${var.app_id}-${var.env_id}-${trimprefix(var.res_id, "modules.")}" } -data "aws_caller_identity" "current" {} - resource "aws_iam_role" "main" { name_prefix = var.prefix // below uses StringLike to allow wildcards for multiple service accounts within the same namespace for workloads @@ -13,7 +11,7 @@ resource "aws_iam_role" "main" { { "Effect" : "Allow", "Principal" : { - "Federated" : "${var.oidc_provider_arn}" + "Federated" : var.oidc_provider_arn, }, "Action" : "sts:AssumeRoleWithWebIdentity", "Condition" : { diff --git a/modules/redis/basic/README.md b/modules/redis/basic/README.md index 98ea044..ceda4cb 100644 --- a/modules/redis/basic/README.md +++ b/modules/redis/basic/README.md @@ -34,7 +34,6 @@ | secret\_key | AWS Secret Key | `string` | n/a | yes | | security\_group\_ids | List of AWS security group IDs to use for the AWS ElastiCache cluster | `set(string)` | n/a | yes | | subnet\_group\_name | Name of the AWS ElastiCache subnet group to use | `string` | n/a | yes | -| force\_destroy | n/a | `bool` | `true` | no | | node\_type | AWS ElastiCache node type | `string` | `"cache.t4g.micro"` | no | | num\_cache\_clusters | Number of AWS ElastiCache clusters | `number` | `1` | no | | parameter\_group\_name | AWS ElastiCache parameter group name | `string` | `"default.redis7.cluster.on"` | no | diff --git a/modules/redis/basic/main.tf b/modules/redis/basic/main.tf index c5ee201..09ccfae 100644 --- a/modules/redis/basic/main.tf +++ b/modules/redis/basic/main.tf @@ -9,7 +9,7 @@ resource "aws_elasticache_replication_group" "main" { description = var.prefix node_type = var.node_type num_cache_clusters = var.num_cache_clusters - parameter_group_name = var.parameter_group_name + parameter_group_name = var.parameter_group_name # tflint-ignore: aws_elasticache_replication_group_default_parameter_group port = var.port subnet_group_name = var.subnet_group_name security_group_ids = var.security_group_ids diff --git a/modules/redis/basic/terraform.tfvars.example b/modules/redis/basic/terraform.tfvars.example index 954416d..c5d87ff 100644 --- a/modules/redis/basic/terraform.tfvars.example +++ b/modules/redis/basic/terraform.tfvars.example @@ -2,9 +2,8 @@ # AWS Access Key access_key = "" -app_id = "" -env_id = "" -force_destroy = true +app_id = "" +env_id = "" # AWS ElastiCache node type node_type = "cache.t4g.micro" diff --git a/modules/redis/basic/variables.tf b/modules/redis/basic/variables.tf index 8d9e294..59b11a6 100644 --- a/modules/redis/basic/variables.tf +++ b/modules/redis/basic/variables.tf @@ -18,11 +18,6 @@ variable "region" { type = string } -variable "force_destroy" { - type = bool - default = true -} - variable "app_id" { type = string } diff --git a/modules/sqs/basic/README.md b/modules/sqs/basic/README.md index 23a1f07..5d0598c 100644 --- a/modules/sqs/basic/README.md +++ b/modules/sqs/basic/README.md @@ -10,7 +10,7 @@ | Name | Source | Version | |------|--------|---------| -| sqs | terraform-aws-modules/sqs/aws | n/a | +| sqs | terraform-aws-modules/sqs/aws | ~> 4 | ## Inputs diff --git a/modules/sqs/basic/main.tf b/modules/sqs/basic/main.tf index d600424..b235415 100644 --- a/modules/sqs/basic/main.tf +++ b/modules/sqs/basic/main.tf @@ -1,5 +1,6 @@ module "sqs" { - source = "terraform-aws-modules/sqs/aws" + source = "terraform-aws-modules/sqs/aws" + version = "~> 4" name = var.prefix use_name_prefix = true