diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 031cae8..7032bd4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: git://github.com/antonbabenko/pre-commit-terraform - rev: v1.48.0 + rev: v1.60.0 hooks: - id: terraform_fmt - id: terraform_tflint @@ -14,18 +14,24 @@ repos: - '--args=--only=terraform_typed_variables' - '--args=--only=terraform_module_pinned_source' - '--args=--only=terraform_naming_convention' + - '--args=--only=terraform_required_providers' + - '--args=--only=terraform_standard_module_structure' - '--args=--only=terraform_workspace_remote' - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.1.0 hooks: - id: trailing-whitespace - - id: check-merge-conflict - id: end-of-file-fixer + - id: check-docstring-first - id: check-yaml + - id: debug-statements + - id: double-quote-string-fixer + - id: name-tests-test + - id: requirements-txt-fixer - repo: https://github.com/bridgecrewio/checkov.git - rev: '2.0.868' + rev: '2.0.914' hooks: - id: checkov verbose: true diff --git a/README.md b/README.md index 0c27bcd..11b4ee2 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ Error: MALFORMED_REQUEST: Failed credentials validation checks: Spot Cancellatio | [existing\_role\_name](#input\_existing\_role\_name) | If you want to use existing role name, else a new role will be created | `string` | `null` | no | | [prjid](#input\_prjid) | Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply' | `string` | n/a | yes | | [profile\_for\_iam](#input\_profile\_for\_iam) | profile to use for IAM | `string` | `null` | no | -| [profile\_to\_use](#input\_profile\_to\_use) | Getting values from ~/.aws/credentials | `string` | `"default"` | no | +| [profile\_to\_use](#input\_profile\_to\_use) | Getting values from ~/.aws/credentials | `string` | `"default"` | no | | [teamid](#input\_teamid) | Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply' | `string` | n/a | yes | ## Outputs diff --git a/examples/sample/main.tf b/examples/sample/main.tf index eb0bf8e..c1277a7 100644 --- a/examples/sample/main.tf +++ b/examples/sample/main.tf @@ -1,5 +1,14 @@ +terraform { + required_version = ">= 1.0.1" + required_providers { + aws = { + version = "~> 3.63" + } + } +} + provider "aws" { - region = "us-west-2" + region = var.aws_region } module "databricks_workspace" { @@ -9,8 +18,8 @@ module "databricks_workspace" { # - 'profile_for_iam' - for IAM creation (if none is provided 'default' is used) # - 'existing_role_name' profile_for_iam = "iam-admin" - #existing_role_name = "arn:aws:iam::123456789012:role/demo-role" - aws_region = "us-east-1" + #existing_role_name = "arn:aws:iam::123456789012:role/demo-role" + aws_region = var.aws_region databricks_account_username = "example@example.com" databricks_account_password = "sample123!" databricks_account_id = "1234567-1234-1234-1234-1234567" diff --git a/examples/sample/variables.tf b/examples/sample/variables.tf index 5464139..3d86b32 100755 --- a/examples/sample/variables.tf +++ b/examples/sample/variables.tf @@ -7,3 +7,9 @@ variable "prjid" { description = "Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'" type = string } + +variable "aws_region" { + description = "AWS region to deploy resources" + type = string + default = "us-west-2" +} diff --git a/locals.tf b/locals.tf index 1742598..6089236 100644 --- a/locals.tf +++ b/locals.tf @@ -1,3 +1,3 @@ locals { - profile_to_use = var.profile_for_iam != null ? var.profile_for_iam : var.profile_to_use + profile = var.profile_for_iam != null ? var.profile_for_iam : var.profile } diff --git a/variables.tf b/variables.tf index d6202f0..9b3edea 100755 --- a/variables.tf +++ b/variables.tf @@ -8,7 +8,7 @@ variable "prjid" { type = string } -variable "profile_to_use" { +variable "profile" { description = "Getting values from ~/.aws/credentials" type = string default = "default" diff --git a/versions.tf b/versions.tf index e97feb7..62d6b6b 100644 --- a/versions.tf +++ b/versions.tf @@ -2,11 +2,11 @@ terraform { required_version = ">= 1.0.1" required_providers { aws = { - version = "~> 3.47" + version = "~> 3.63" } databricks = { source = "databrickslabs/databricks" - version = "0.4.7" + version = "0.5.1" } random = { version = "~> 3.1" @@ -19,14 +19,14 @@ terraform { provider "aws" { region = var.aws_region - profile = var.profile_to_use + profile = var.profile } provider "aws" { alias = "iam-management" region = var.aws_region - profile = local.profile_to_use + profile = local.profile } # initialize provider in "MWS" mode to provision new workspace