diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c261675..17fe1fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,24 +1,24 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.76.0 + rev: v1.77.1 hooks: - id: terraform_fmt - 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_naming_convention' - - '--args=--only=terraform_required_providers' - - '--args=--only=terraform_standard_module_structure' - - '--args=--only=terraform_workspace_remote' + - "--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_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: v4.3.0 + rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -30,8 +30,8 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/bridgecrewio/checkov.git - rev: '2.1.280' + rev: "2.1.280" hooks: - - id: checkov - verbose: true - args: [-d, '.', --framework,'terraform'] + - id: checkov + verbose: true + args: [-d, ".", --framework, "terraform"] diff --git a/README.md b/README.md index 62d862c..c39441e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ - AWS provider version [4.35](https://registry.terraform.io/providers/hashicorp/aws/latest). - `main` branch: Provider versions not pinned to keep up with Terraform releases. - `tags` releases: Tags are pinned with versions (use - in your releases). + in your releases). ### Usage @@ -33,23 +33,27 @@ terraform plan -var='teamid=tryme' -var='prjid=project1' terraform apply -var='teamid=tryme' -var='prjid=project1' terraform destroy -var='teamid=tryme' -var='prjid=project1' ``` + **Note:** With this option please take care of remote state storage #### Option 2: -##### Recommended method (stores remote state in remote backend(S3, Azure storage, or Google bucket) using `prjid` and `teamid` to create directory structure): +##### Recommended method (stores remote state in remote backend(S3, Azure storage, or Google bucket) using `prjid` and `teamid` to create directory structure): - Create python 3.8+ virtual environment + ``` python3 -m venv ``` - Install package: + ``` pip install tfremote --upgrade ``` - Set below environment variables: + ``` export TF_AWS_BUCKET= export TF_AWS_BUCKET_REGION=us-west-2 @@ -59,6 +63,7 @@ export TF_AWS_PROFILE= or - Set below environment variables: + ``` export TF_AWS_BUCKET= export TF_AWS_BUCKET_REGION=us-west-2 @@ -69,16 +74,19 @@ export AWS_SECRET_ACCESS_KEY= - Updated `examples` directory with required values. - Run and verify the output before deploying: + ``` tf -c=aws plan -var='teamid=foo' -var='prjid=bar' ``` - Run below to deploy: + ``` tf -c=aws apply -var='teamid=foo' -var='prjid=bar' ``` - Run below to destroy: + ``` tf -c=aws destroy -var='teamid=foo' -var='prjid=bar' ``` @@ -86,12 +94,13 @@ tf -c=aws destroy -var='teamid=foo' -var='prjid=bar' **Note:** Read more on [tfremote](https://github.com/tomarv2/tfremote) ##### WAF with custom IP and `AND` rule + ``` terraform { required_version = ">= 1.0.1" required_providers { aws = { - version = "~> 4.35" + version = "~> 4.61" } } } @@ -101,7 +110,7 @@ provider "aws" { } module "common" { - source = "git::git@github.com:tomarv2/terraform-global.git//common?ref=v0.0.1" + source = "github.com/tomarv2/terraform-global.git//common?ref=v0.0.1" } ##### @@ -193,13 +202,13 @@ Please refer to examples directory [link](examples) for references. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0.1 | -| [aws](#requirement\_aws) | ~> 4.35 | +| [aws](#requirement\_aws) | ~> 4.61 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | ~> 4.35 | +| [aws](#provider\_aws) | ~> 4.61 | ## Modules diff --git a/examples/with_ip_set_and_rule/main.tf b/examples/with_ip_set_and_rule/main.tf index c510eca..20288ed 100644 --- a/examples/with_ip_set_and_rule/main.tf +++ b/examples/with_ip_set_and_rule/main.tf @@ -2,7 +2,7 @@ terraform { required_version = ">= 1.0.1" required_providers { aws = { - version = "~> 4.35" + version = "~> 4.61" } } } @@ -12,7 +12,7 @@ provider "aws" { } module "common" { - source = "git::git@github.com:tomarv2/terraform-global.git//common?ref=v0.0.1" + source = "github.com/tomarv2/terraform-global.git//common?ref=v0.0.1" } ##### @@ -116,4 +116,4 @@ module "waf" { ] teamid = var.teamid prjid = var.prjid -} \ No newline at end of file +} diff --git a/providers.tf b/providers.tf index 6c0e9ed..dbf0906 100644 --- a/providers.tf +++ b/providers.tf @@ -2,7 +2,7 @@ terraform { required_version = ">= 1.0.1" required_providers { aws = { - version = "~> 4.35" + version = "~> 4.61" } } }