Skip to content

Pulling refs/heads/develop into main #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://github.com/tomarv2/terraform-aws-waf/tags" alt="GitHub tag">
<img src="https://img.shields.io/github/v/tag/tomarv2/terraform-aws-waf" /></a> in your releases).
<img src="https://img.shields.io/github/v/tag/tomarv2/terraform-aws-waf" /></a> in your releases).

### Usage

Expand All @@ -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 <venv name>
```

- Install package:

```
pip install tfremote --upgrade
```

- Set below environment variables:

```
export TF_AWS_BUCKET=<remote state bucket name>
export TF_AWS_BUCKET_REGION=us-west-2
Expand All @@ -59,6 +63,7 @@ export TF_AWS_PROFILE=<profile from ~/.ws/credentials>
or

- Set below environment variables:

```
export TF_AWS_BUCKET=<remote state bucket name>
export TF_AWS_BUCKET_REGION=us-west-2
Expand All @@ -69,29 +74,33 @@ export AWS_SECRET_ACCESS_KEY=<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'
```

**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"
}
}
}
Expand All @@ -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"
}

#####
Expand Down Expand Up @@ -193,13 +202,13 @@ Please refer to examples directory [link](examples) for references.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.35 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.61 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.35 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.61 |

## Modules

Expand Down
6 changes: 3 additions & 3 deletions examples/with_ip_set_and_rule/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 1.0.1"
required_providers {
aws = {
version = "~> 4.35"
version = "~> 4.61"
}
}
}
Expand All @@ -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"
}

#####
Expand Down Expand Up @@ -116,4 +116,4 @@ module "waf" {
]
teamid = var.teamid
prjid = var.prjid
}
}
2 changes: 1 addition & 1 deletion providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 1.0.1"
required_providers {
aws = {
version = "~> 4.35"
version = "~> 4.61"
}
}
}