Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 2a817dc

Browse files
authored
feat: upgrade Terraform version of module 1.0.x (#1254)
* Upgrade terraform version, pre-commit, update ci * Update workflows, check format for examples * Add direction to contributing guide
1 parent 4cb5cf1 commit 2a817dc

File tree

19 files changed

+420
-303
lines changed

19 files changed

+420
-303
lines changed

Diff for: .github/workflows/terraform.yml

+42-30
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ on:
99
- "modules/*/lambdas/**"
1010

1111
env:
12-
tf_version: "0.13.5"
12+
tf_version: "1.0."
1313
tf_working_dir: "."
1414
AWS_REGION: eu-west-1
1515
jobs:
16-
terraform:
17-
name: "Terraform"
16+
17+
verify_module:
18+
name: Verify module
19+
strategy:
20+
matrix:
21+
terraform: [1.0.8]
1822
runs-on: ubuntu-latest
23+
container:
24+
image: hashicorp/terraform:${{ matrix.terraform }}
1925
steps:
2026
- name: "Checkout"
2127
uses: actions/checkout@v2
@@ -24,30 +30,36 @@ jobs:
2430
touch modules/webhook/lambdas/webhook/webhook.zip
2531
touch modules/runners/lambdas/runners/runners.zip
2632
touch modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/runner-binaries-syncer.zip
27-
- name: "Terraform Format"
28-
uses: hashicorp/terraform-github-actions@master
29-
with:
30-
tf_actions_version: ${{ env.tf_version }}
31-
tf_actions_subcommand: "fmt"
32-
tf_actions_working_dir: ${{ env.tf_working_dir }}
33-
tf_actions_comment: true
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
- name: "Terraform Init"
37-
uses: hashicorp/terraform-github-actions@master
38-
with:
39-
tf_actions_version: ${{ env.tf_version }}
40-
tf_actions_subcommand: "init"
41-
tf_actions_working_dir: ${{ env.tf_working_dir }}
42-
tf_actions_comment: true
43-
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
- name: "Terraform Validate"
46-
uses: hashicorp/terraform-github-actions@master
47-
with:
48-
tf_actions_version: ${{ env.tf_version }}
49-
tf_actions_subcommand: "validate"
50-
tf_actions_working_dir: ${{ env.tf_working_dir }}
51-
tf_actions_comment: true
52-
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
- name: terraform init
34+
run: terraform init -get -backend=false -input=false
35+
- name: check terraform formatting
36+
run: terraform fmt -recursive -check=true -write=false
37+
continue-on-error: true
38+
- name: validate terraform
39+
run: terraform validate
40+
41+
verify_examples:
42+
name: Verify examples
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
terraform: [0.14.1, 0.15.0, 1.0.8]
47+
example: ["default", "ubuntu"]
48+
defaults:
49+
run:
50+
working-directory: examples/${{ matrix.example }}
51+
runs-on: ubuntu-latest
52+
container:
53+
image: hashicorp/terraform:${{ matrix.terraform }}
54+
steps:
55+
- uses: actions/checkout@v2
56+
- name: terraform init
57+
run: terraform init -get -backend=false -input=false
58+
- if: contains(matrix.terraform, '1.0.')
59+
name: check terraform formatting
60+
run: terraform fmt -recursive -check=true -write=false
61+
continue-on-error: true
62+
- name: validate terraform
63+
run: terraform validate
64+
65+

Diff for: .pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.47.0
3+
rev: v1.52.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_tflint
77
- id: terraform_docs
88
- repo: git://github.com/pre-commit/pre-commit-hooks
9-
rev: v3.4.0
9+
rev: v4.0.1
1010
hooks:
1111
- id: check-merge-conflict

Diff for: CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Before you submit your merge request consider the following guidelines:
6262
```
6363

6464
* Create your patch, **including appropriate test cases**.
65-
* Run the test suite and ensure that all tests pass.
65+
* Install [Terraform](https://www.terraform.io/). We lock the version with [tvenv](https://github.com/tfutils/tfenv), check `.terraform-version` for the current development version of the module.
6666
* Install [pre-commit hooks](https://pre-commit.com/). The hooks runs some basic checks and update the docs. The commit will run the hooks, you can invoke the hooks manually `pre-commit run --all-files` as well.
6767
* Commit your changes using a descriptive commit message.
6868

@@ -79,7 +79,7 @@ Before you submit your merge request consider the following guidelines:
7979
git push origin my-fix-branch
8080
```
8181

82-
In Github, send a pull request to original develop branch: f.e. `terraform-aws-vpc:develop`.
82+
In Github, send a pull request to original develop branch: f.e. `terraform-aws-github-runner:develop`.
8383
If we suggest changes, then:
8484

8585
* Make the required updates.

Diff for: README.md

+80-77
Large diffs are not rendered by default.

Diff for: examples/.terraform-version

-1
This file was deleted.

Diff for: examples/default/.terraform-version

-1
This file was deleted.

Diff for: examples/ubuntu/.terraform.lock.hcl

+57
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: examples/ubuntu/providers.tf

-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
terraform {
2-
required_providers {
3-
aws = {
4-
version = "3.27"
5-
}
6-
random = {
7-
version = "3.1.0"
8-
}
9-
}
10-
}
11-
12-
131
provider "aws" {
142
region = local.aws_region
153

Diff for: modules/download-lambda/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@ No requirements.
3333

3434
| Name | Version |
3535
|------|---------|
36-
| null | n/a |
36+
| <a name="provider_null"></a> [null](#provider\_null) | 3.0.0 |
3737

3838
## Modules
3939

40-
No Modules.
40+
No modules.
4141

4242
## Resources
4343

44-
| Name |
45-
|------|
46-
| [null_resource](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) |
44+
| Name | Type |
45+
|------|------|
46+
| [null_resource.download](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
4747

4848
## Inputs
4949

5050
| Name | Description | Type | Default | Required |
5151
|------|-------------|------|---------|:--------:|
52-
| lambdas | Name and tag for lambdas to download. | <pre>list(object({<br> name = string<br> tag = string<br> }))</pre> | n/a | yes |
52+
| <a name="input_lambdas"></a> [lambdas](#input\_lambdas) | Name and tag for lambdas to download. | <pre>list(object({<br> name = string<br> tag = string<br> }))</pre> | n/a | yes |
5353

5454
## Outputs
5555

5656
| Name | Description |
5757
|------|-------------|
58-
| files | n/a |
58+
| <a name="output_files"></a> [files](#output\_files) | n/a |
5959
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6060

6161
## Philips Forest

Diff for: modules/runner-binaries-syncer/README.md

+44-39
Original file line numberDiff line numberDiff line change
@@ -36,66 +36,71 @@ yarn run dist
3636
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
3737
## Requirements
3838

39-
No requirements.
39+
| Name | Version |
40+
|------|---------|
41+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.1 |
42+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.38 |
4043

4144
## Providers
4245

4346
| Name | Version |
4447
|------|---------|
45-
| aws | n/a |
48+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.38 |
4649

4750
## Modules
4851

49-
No Modules.
52+
No modules.
5053

5154
## Resources
5255

53-
| Name |
54-
|------|
55-
| [aws_caller_identity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) |
56-
| [aws_cloudwatch_event_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) |
57-
| [aws_cloudwatch_event_target](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) |
58-
| [aws_cloudwatch_log_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) |
59-
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
60-
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
61-
| [aws_iam_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) |
62-
| [aws_lambda_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) |
63-
| [aws_lambda_permission](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) |
64-
| [aws_s3_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) |
65-
| [aws_s3_bucket_notification](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_notification) |
66-
| [aws_s3_bucket_object](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object) |
67-
| [aws_s3_bucket_public_access_block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) |
56+
| Name | Type |
57+
|------|------|
58+
| [aws_cloudwatch_event_rule.syncer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_rule) | resource |
59+
| [aws_cloudwatch_event_target.syncer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |
60+
| [aws_cloudwatch_log_group.syncer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
61+
| [aws_iam_role.syncer_lambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
62+
| [aws_iam_role_policy.lambda_logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
63+
| [aws_iam_role_policy.syncer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
64+
| [aws_lambda_function.syncer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
65+
| [aws_lambda_permission.on_deploy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
66+
| [aws_lambda_permission.syncer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
67+
| [aws_s3_bucket.action_dist](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
68+
| [aws_s3_bucket_notification.on_deploy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_notification) | resource |
69+
| [aws_s3_bucket_object.trigger](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object) | resource |
70+
| [aws_s3_bucket_public_access_block.action_dist](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
71+
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
72+
| [aws_iam_policy_document.lambda_assume_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
6873

6974
## Inputs
7075

7176
| Name | Description | Type | Default | Required |
7277
|------|-------------|------|---------|:--------:|
73-
| aws\_region | AWS region. | `string` | n/a | yes |
74-
| distribution\_bucket\_name | Bucket for storing the action runner distribution. | `string` | n/a | yes |
75-
| environment | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
76-
| lambda\_s3\_bucket | S3 bucket from which to specify lambda functions. This is an alternative to providing local files directly. | `any` | `null` | no |
77-
| lambda\_schedule\_expression | Scheduler expression for action runner binary syncer. | `string` | `"cron(27 * * * ? *)"` | no |
78-
| lambda\_security\_group\_ids | List of security group IDs associated with the Lambda function. | `list(string)` | `[]` | no |
79-
| lambda\_subnet\_ids | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | `[]` | no |
80-
| lambda\_timeout | Time out of the lambda in seconds. | `number` | `300` | no |
81-
| lambda\_zip | File location of the lambda zip file. | `string` | `null` | no |
82-
| logging\_retention\_in\_days | Specifies the number of days you want to retain log events for the lambda log group. Possible values are: 0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653. | `number` | `7` | no |
83-
| role\_path | The path that will be added to the role, if not set the environment name will be used. | `string` | `null` | no |
84-
| role\_permissions\_boundary | Permissions boundary that will be added to the created role for the lambda. | `string` | `null` | no |
85-
| runner\_allow\_prerelease\_binaries | Allow the runners to update to prerelease binaries. | `bool` | `false` | no |
86-
| runner\_architecture | The platform architecture for the runner instance (x64, arm64), defaults to 'x64' | `string` | `"x64"` | no |
87-
| syncer\_lambda\_s3\_key | S3 key for syncer lambda function. Required if using S3 bucket to specify lambdas. | `any` | `null` | no |
88-
| syncer\_lambda\_s3\_object\_version | S3 object version for syncer lambda function. Useful if S3 versioning is enabled on source bucket. | `any` | `null` | no |
89-
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
78+
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes |
79+
| <a name="input_distribution_bucket_name"></a> [distribution\_bucket\_name](#input\_distribution\_bucket\_name) | Bucket for storing the action runner distribution. | `string` | n/a | yes |
80+
| <a name="input_environment"></a> [environment](#input\_environment) | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
81+
| <a name="input_lambda_s3_bucket"></a> [lambda\_s3\_bucket](#input\_lambda\_s3\_bucket) | S3 bucket from which to specify lambda functions. This is an alternative to providing local files directly. | `any` | `null` | no |
82+
| <a name="input_lambda_schedule_expression"></a> [lambda\_schedule\_expression](#input\_lambda\_schedule\_expression) | Scheduler expression for action runner binary syncer. | `string` | `"cron(27 * * * ? *)"` | no |
83+
| <a name="input_lambda_security_group_ids"></a> [lambda\_security\_group\_ids](#input\_lambda\_security\_group\_ids) | List of security group IDs associated with the Lambda function. | `list(string)` | `[]` | no |
84+
| <a name="input_lambda_subnet_ids"></a> [lambda\_subnet\_ids](#input\_lambda\_subnet\_ids) | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | `[]` | no |
85+
| <a name="input_lambda_timeout"></a> [lambda\_timeout](#input\_lambda\_timeout) | Time out of the lambda in seconds. | `number` | `300` | no |
86+
| <a name="input_lambda_zip"></a> [lambda\_zip](#input\_lambda\_zip) | File location of the lambda zip file. | `string` | `null` | no |
87+
| <a name="input_logging_retention_in_days"></a> [logging\_retention\_in\_days](#input\_logging\_retention\_in\_days) | Specifies the number of days you want to retain log events for the lambda log group. Possible values are: 0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653. | `number` | `7` | no |
88+
| <a name="input_role_path"></a> [role\_path](#input\_role\_path) | The path that will be added to the role, if not set the environment name will be used. | `string` | `null` | no |
89+
| <a name="input_role_permissions_boundary"></a> [role\_permissions\_boundary](#input\_role\_permissions\_boundary) | Permissions boundary that will be added to the created role for the lambda. | `string` | `null` | no |
90+
| <a name="input_runner_allow_prerelease_binaries"></a> [runner\_allow\_prerelease\_binaries](#input\_runner\_allow\_prerelease\_binaries) | Allow the runners to update to prerelease binaries. | `bool` | `false` | no |
91+
| <a name="input_runner_architecture"></a> [runner\_architecture](#input\_runner\_architecture) | The platform architecture for the runner instance (x64, arm64), defaults to 'x64' | `string` | `"x64"` | no |
92+
| <a name="input_syncer_lambda_s3_key"></a> [syncer\_lambda\_s3\_key](#input\_syncer\_lambda\_s3\_key) | S3 key for syncer lambda function. Required if using S3 bucket to specify lambdas. | `any` | `null` | no |
93+
| <a name="input_syncer_lambda_s3_object_version"></a> [syncer\_lambda\_s3\_object\_version](#input\_syncer\_lambda\_s3\_object\_version) | S3 object version for syncer lambda function. Useful if S3 versioning is enabled on source bucket. | `any` | `null` | no |
94+
| <a name="input_tags"></a> [tags](#input\_tags) | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
9095

9196
## Outputs
9297

9398
| Name | Description |
9499
|------|-------------|
95-
| bucket | n/a |
96-
| lambda | n/a |
97-
| lambda\_role | n/a |
98-
| runner\_distribution\_object\_key | n/a |
100+
| <a name="output_bucket"></a> [bucket](#output\_bucket) | n/a |
101+
| <a name="output_lambda"></a> [lambda](#output\_lambda) | n/a |
102+
| <a name="output_lambda_role"></a> [lambda\_role](#output\_lambda\_role) | n/a |
103+
| <a name="output_runner_distribution_object_key"></a> [runner\_distribution\_object\_key](#output\_runner\_distribution\_object\_key) | n/a |
99104
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
100105

101106
## Philips Forest

Diff for: modules/runner-binaries-syncer/versions.tf

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
terraform {
2+
required_version = ">= 0.14.1"
3+
24
required_providers {
35
aws = {
4-
source = "aws"
5-
version = ">=3.27"
6+
source = "hashicorp/aws"
7+
version = ">= 3.38"
68
}
79
}
810
}

0 commit comments

Comments
 (0)