Skip to content

Commit b1cc843

Browse files
committed
upgrading to 1.0.1
1 parent 3c1882d commit b1cc843

File tree

14 files changed

+165
-108
lines changed

14 files changed

+165
-108
lines changed

.github/workflows/onrelease.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: release
8+
9+
jobs:
10+
build:
11+
name: Create Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Create Release
18+
id: create_release
19+
uses: actions/create-release@v1
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
with:
23+
tag_name: ${{ github.ref }}
24+
release_name: Release ${{ github.ref }}
25+
body: |
26+
Release for version ${{ github.ref }}. Please check CHANGELOG.md for more information.
27+
draft: false
28+
prerelease: false

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ _testmain.go
8080
/test/times.out
8181

8282
# ignore test file(s)
83-
**test**
83+
**test**

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
repos:
2+
- repo: git://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.48.0
4+
hooks:
5+
- id: terraform_fmt
6+
- id: terraform_validate
7+
- id: terraform_tflint
8+
args:
9+
- '--args=--only=terraform_deprecated_interpolation'
10+
- '--args=--only=terraform_deprecated_index'
11+
- '--args=--only=terraform_unused_declarations' #
12+
- '--args=--only=terraform_comment_syntax'
13+
- '--args=--only=terraform_documented_outputs'
14+
- '--args=--only=terraform_documented_variables'
15+
- '--args=--only=terraform_typed_variables'
16+
- '--args=--only=terraform_module_pinned_source'
17+
- '--args=--only=terraform_naming_convention'
18+
#- '--args=--only=terraform_required_providers'
19+
- '--args=--only=terraform_standard_module_structure' #
20+
- '--args=--only=terraform_workspace_remote'
21+
22+
- repo: https://github.com/pre-commit/pre-commit-hooks
23+
rev: v3.2.0
24+
hooks:
25+
- id: trailing-whitespace
26+
- id: check-merge-conflict
27+
- id: end-of-file-fixer
28+
- id: check-yaml
29+
30+
- repo: https://github.com/bridgecrewio/checkov.git
31+
rev: '1.0.864' # change to tag or sha
32+
hooks:
33+
- id: checkov
34+
verbose: true
35+
args:
36+
- -d . --framework terraform -o output_format json

README.md

Lines changed: 43 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
2-
<a href="https://github.com/tomarv2/terraform-aws-target-group/actions/workflows/security_scans.yml" alt="Security Scans">
3-
<img src="https://github.com/tomarv2/terraform-aws-target-group/actions/workflows/security_scans.yml/badge.svg?branch=main" /></a>
2+
<a href="https://github.com/tomarv2/terraform-aws-target-group/actions/workflows/pre-commit.yml" alt="Pre commit">
3+
<img src="https://github.com/tomarv2/terraform-aws-target-group/actions/workflows/pre-commit.yml/badge.svg?branch=main" /></a>
44
<a href="https://www.apache.org/licenses/LICENSE-2.0" alt="license">
55
<img src="https://img.shields.io/github/license/tomarv2/terraform-aws-target-group" /></a>
66
<a href="https://github.com/tomarv2/terraform-aws-target-group/tags" alt="GitHub tag">
@@ -19,66 +19,79 @@
1919

2020
## Versions
2121

22-
- Module tested for Terraform 0.14.
23-
- AWS provider version [3.29.0](https://registry.terraform.io/providers/hashicorp/aws/latest)
24-
- `main` branch: Provider versions not pinned to keep up with Terraform releases
22+
- Module tested for Terraform 1.0.1.
23+
- AWS provider version [3.47.0](https://registry.terraform.io/providers/hashicorp/aws/latest)
24+
- `main` branch: Provider versions not pinned to keep up with Terraform releases.
2525
- `tags` releases: Tags are pinned with versions (use <a href="https://github.com/tomarv2/terraform-aws-target-group/tags" alt="GitHub tag">
26-
<img src="https://img.shields.io/github/v/tag/tomarv2/terraform-aws-target-group" /></a> in your releases)
26+
<img src="https://img.shields.io/github/v/tag/tomarv2/terraform-aws-target-group" /></a> ).
2727

28-
**NOTE:**
28+
---
29+
## Usage
2930

30-
- Read more on [tfremote](https://github.com/tomarv2/tfremote)
31+
### Option 1:
3132

32-
## Usage
33+
```
34+
terrafrom init
35+
terraform plan -var='teamid=tryme' -var='prjid=project1'
36+
terraform apply -var='teamid=tryme' -var='prjid=project1'
37+
terraform destroy -var='teamid=tryme' -var='prjid=project1'
38+
```
39+
**Note:** With this option please take care of remote state storage
3340

34-
Recommended method:
41+
### Option 2:
3542

36-
- Create python 3.6+ virtual environment
43+
#### Recommended method (store remote state in S3 using prjid and teamid to create directory structure):
44+
45+
- Create python 3.6+ virtual environment
3746
```
3847
python3 -m venv <venv name>
3948
```
4049

4150
- Install package:
4251
```
43-
pip install tfremote
52+
pip install tfremote --upgrade
53+
```
54+
55+
- Set below environment variables:
56+
```
57+
export TF_AWS_BUCKET=<remote state bucket name>
58+
export TF_AWS_BUCKET_REGION=us-west-2
59+
export TF_AWS_PROFILE=<profile from ~/.ws/credentials>
4460
```
4561

62+
or
63+
4664
- Set below environment variables:
4765
```
4866
export TF_AWS_BUCKET=<remote state bucket name>
49-
export TF_AWS_PROFILE=default
5067
export TF_AWS_BUCKET_REGION=us-west-2
51-
```
68+
export AWS_ACCESS_KEY_ID=<aws_access_key_id>
69+
export AWS_SECRET_ACCESS_KEY=<aws_secret_access_key>
70+
```
5271

53-
- Updated `examples` directory with required values.
72+
- Updated `examples` directory with required values.
5473

5574
- Run and verify the output before deploying:
5675
```
57-
tf -cloud aws plan -var='teamid=foo' -var='prjid=bar'
76+
tf -c=aws plan -var='teamid=foo' -var='prjid=bar'
5877
```
5978

6079
- Run below to deploy:
6180
```
62-
tf -cloud aws apply -var='teamid=foo' -var='prjid=bar'
81+
tf -c=aws apply -var='teamid=foo' -var='prjid=bar'
6382
```
6483

6584
- Run below to destroy:
6685
```
67-
tf -cloud aws destroy -var='teamid=foo' -var='prjid=bar'
86+
tf -c=aws destroy -var='teamid=foo' -var='prjid=bar'
6887
```
6988

70-
> ❗️ **Important** - Two variables are required for using `tf` package:
71-
>
72-
> - teamid
73-
> - prjid
74-
>
75-
> These variables are required to set backend path in the remote storage.
76-
> Variables can be defined using:
77-
>
78-
> - As `inline variables` e.g.: `-var='teamid=demo-team' -var='prjid=demo-project'`
79-
> - Inside `.tfvars` file e.g.: `-var-file=<tfvars file location> `
80-
>
81-
> For more information refer to [Terraform documentation](https://www.terraform.io/docs/language/values/variables.html)
89+
**NOTE:**
90+
91+
- Read more on [tfremote](https://github.com/tomarv2/tfremote)
92+
---
93+
94+
Please refer to examples directory [link](examples) for references.
8295

8396
##### Target Group
8497
```
@@ -99,50 +112,6 @@ module "target_group" {
99112
teamid = var.teamid
100113
prjid = var.prjid
101114
}
102-
103115
```
104116

105117
Please refer to examples directory [link](examples) for references.
106-
107-
## Requirements
108-
109-
| Name | Version |
110-
|------|---------|
111-
| terraform | >= 0.14 |
112-
| aws | ~> 3.29 |
113-
114-
## Providers
115-
116-
| Name | Version |
117-
|------|---------|
118-
| aws | ~> 3.29 |
119-
120-
## Inputs
121-
122-
| Name | Description | Type | Default | Required |
123-
|------|-------------|------|---------|:--------:|
124-
| account\_id | (Required) AWS account id (used to pull values from shared base module like vpc info, subnet ids) | `any` | n/a | yes |
125-
| alb\_action\_type | n/a | `string` | `"forward"` | no |
126-
| alb\_cert\_arn | alb cert arn | `string` | `""` | no |
127-
| alb\_ssl\_policy | alb ssl policy | `string` | `""` | no |
128-
| aws\_region | The AWS region to create resources | `string` | `"us-west-2"` | no |
129-
| deregistration\_delay | n/a | `string` | `"300"` | no |
130-
| healthcheck\_interval | n/a | `string` | `""` | no |
131-
| healthcheck\_matcher | healthcheck matcher (e.g. 200) | `string` | `""` | no |
132-
| healthcheck\_path | target group healthcheck path | `string` | `""` | no |
133-
| healthcheck\_timeout | n/a | `string` | `""` | no |
134-
| healthy\_threshold | target group healthcheck threshold | `string` | `""` | no |
135-
| lb\_port | n/a | `list` | <pre>[<br> 80<br>]</pre> | no |
136-
| lb\_protocol | n/a | `string` | `"HTTP"` | no |
137-
| prjid | (Required) Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply' | `any` | n/a | yes |
138-
| profile\_to\_use | Getting values from ~/.aws/credentials | `string` | `"default"` | no |
139-
| stickiness | Target group sticky configuration | <pre>object({<br> cookie_duration = number<br> enabled = bool<br> })</pre> | `null` | no |
140-
| target\_type | n/a | `string` | `"instance"` | no |
141-
| teamid | (Required) Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply' | `any` | n/a | yes |
142-
| unhealthy\_threshold | target group unheathy healthcheck threshold | `string` | `""` | no |
143-
144-
## Outputs
145-
146-
| Name | Description |
147-
|------|-------------|
148-
| target\_group\_arn | n/a |

examples/main.tf renamed to examples/sample/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
provider "aws" {
2+
region = "us-west-2"
3+
profile = "default"
4+
}
5+
16
module "target_group" {
2-
source = "../"
7+
source = "../../"
38

49
account_id = "12345679012"
510
lb_protocol = "HTTP"
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
variable "teamid" {
22
description = "(Required) Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply'"
3+
type = string
34
}
45

56
variable "prjid" {
67
description = "(Required) Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'"
8+
type = string
79
}

main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ module "global" {
33
}
44

55
locals {
6-
shared_tags = map(
7-
"name", "${var.teamid}-${var.prjid}",
8-
"team", var.teamid,
9-
"project", var.prjid
6+
shared_tags = tomap(
7+
{
8+
"Name" = "${var.teamid}-${var.prjid}",
9+
"team" = var.teamid,
10+
"project" = var.prjid
11+
}
1012
)
1113
}

0 commit comments

Comments
 (0)