Commit f24f6544 authored by Bryant Biggs's avatar Bryant Biggs Committed by GitHub

chore: update CI/CD to use stable `terraform-docs` release artifact and...

chore: update CI/CD to use stable `terraform-docs` release artifact and discoverable Apache2.0 license (#217)
parent 334dbbda
...@@ -7,30 +7,30 @@ on: ...@@ -7,30 +7,30 @@ on:
- master - master
jobs: jobs:
# Min Terraform version(s) # Min Terraform version(s)
getDirectories: getDirectories:
name: Get root directories name: Get root directories
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Python - name: Install Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
- name: Build matrix - name: Build matrix
id: matrix id: matrix
run: | run: |
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))") DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))")
echo "::set-output name=directories::$DIRS" echo "::set-output name=directories::$DIRS"
outputs: outputs:
directories: ${{ steps.matrix.outputs.directories }} directories: ${{ steps.matrix.outputs.directories }}
preCommitMinVersions: preCommitMinVersions:
name: Min TF validate name: Min TF validate
needs: getDirectories needs: getDirectories
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
directory: ${{ fromJson(needs.getDirectories.outputs.directories) }} directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
...@@ -38,7 +38,7 @@ jobs: ...@@ -38,7 +38,7 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
- name: Terraform min/max versions - name: Terraform min/max versions
id: minMax id: minMax
uses: clowdhaus/terraform-min-max@v1.0.1 uses: clowdhaus/terraform-min-max@v1.0.2
with: with:
directory: ${{ matrix.directory }} directory: ${{ matrix.directory }}
- name: Install Terraform v${{ steps.minMax.outputs.minVersion }} - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}
...@@ -50,16 +50,13 @@ jobs: ...@@ -50,16 +50,13 @@ jobs:
- name: Execute pre-commit - name: Execute pre-commit
# Run only validate pre-commit check on min version supported # Run only validate pre-commit check on min version supported
if: ${{ matrix.directory != '.' }} if: ${{ matrix.directory != '.' }}
run: run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*
pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*
- name: Execute pre-commit - name: Execute pre-commit
# Run only validate pre-commit check on min version supported # Run only validate pre-commit check on min version supported
if: ${{ matrix.directory == '.' }} if: ${{ matrix.directory == '.' }}
run: run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)
pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)
# Max Terraform version # Max Terraform version
getBaseVersion: getBaseVersion:
name: Module max TF version name: Module max TF version
runs-on: ubuntu-latest runs-on: ubuntu-latest
...@@ -68,7 +65,7 @@ jobs: ...@@ -68,7 +65,7 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Terraform min/max versions - name: Terraform min/max versions
id: minMax id: minMax
uses: clowdhaus/terraform-min-max@v1.0.1 uses: clowdhaus/terraform-min-max@v1.0.2
outputs: outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }} minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }} maxVersion: ${{ steps.minMax.outputs.maxVersion }}
...@@ -94,7 +91,7 @@ jobs: ...@@ -94,7 +91,7 @@ jobs:
- name: Install pre-commit dependencies - name: Install pre-commit dependencies
run: | run: |
pip install pre-commit pip install pre-commit
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12.0-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/ curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.13.0/terraform-docs-v0.13.0-$(uname)-amd64.tar.gz && tar -xzf terraform-docs.tar.gz && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/ curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
- name: Execute pre-commit - name: Execute pre-commit
# Run all pre-commit checks on max version supported # Run all pre-commit checks on max version supported
......
repos: repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform - repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.48.0 rev: v1.50.0
hooks: hooks:
- id: terraform_fmt - id: terraform_fmt
- id: terraform_validate - id: terraform_validate
......
This diff is collapsed.
...@@ -2,16 +2,6 @@ ...@@ -2,16 +2,6 @@
Terraform module which creates EC2 instance(s) on AWS. Terraform module which creates EC2 instance(s) on AWS.
These types of resources are supported:
* [EC2 instance](https://www.terraform.io/docs/providers/aws/r/instance.html)
## Terraform versions
Terraform 0.12. Pin module version to `~> v2.0`. Submit pull-requests to `master` branch.
Terraform 0.11. Pin module version to `~> v1.0`. Submit pull-requests to `terraform011` branch.
## Usage ## Usage
```hcl ```hcl
...@@ -38,8 +28,8 @@ module "ec2_cluster" { ...@@ -38,8 +28,8 @@ module "ec2_cluster" {
## Examples ## Examples
* [Basic EC2 instance](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/basic) - [Basic EC2 instance](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/basic)
* [EC2 instance with EBS volume attachment](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/volume-attachment) - [EC2 instance with EBS volume attachment](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/volume-attachment)
## Make an encrypted AMI for use ## Make an encrypted AMI for use
...@@ -47,7 +37,6 @@ This module does not support encrypted AMI's out of the box however it is easy e ...@@ -47,7 +37,6 @@ This module does not support encrypted AMI's out of the box however it is easy e
This example creates an encrypted image from the latest ubuntu 16.04 base image. This example creates an encrypted image from the latest ubuntu 16.04 base image.
```hcl ```hcl
resource "aws_ami_copy" "ubuntu-xenial-encrypted-ami" { resource "aws_ami_copy" "ubuntu-xenial-encrypted-ami" {
name = "ubuntu-xenial-encrypted-ami" name = "ubuntu-xenial-encrypted-ami"
...@@ -84,12 +73,11 @@ data "aws_ami" "ubuntu-xenial" { ...@@ -84,12 +73,11 @@ data "aws_ami" "ubuntu-xenial" {
} }
``` ```
## Notes ## Notes
* `network_interface` can't be specified together with `vpc_security_group_ids`, `associate_public_ip_address`, `subnet_id`. See [basic example](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/basic) for details. - `network_interface` can't be specified together with `vpc_security_group_ids`, `associate_public_ip_address`, `subnet_id`. See [basic example](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/basic) for details.
* Changes in `ebs_block_device` argument will be ignored. Use [aws_volume_attachment](https://www.terraform.io/docs/providers/aws/r/volume_attachment.html) resource to attach and detach volumes from AWS EC2 instances. See [this example](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/volume-attachment). - Changes in `ebs_block_device` argument will be ignored. Use [aws_volume_attachment](https://www.terraform.io/docs/providers/aws/r/volume_attachment.html) resource to attach and detach volumes from AWS EC2 instances. See [this example](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/volume-attachment).
* One of `subnet_id` or `subnet_ids` is required. If both are provided, the value of `subnet_id` is prepended to the value of `subnet_ids`. - One of `subnet_id` or `subnet_ids` is required. If both are provided, the value of `subnet_id` is prepended to the value of `subnet_ids`.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements ## Requirements
...@@ -185,8 +173,8 @@ No modules. ...@@ -185,8 +173,8 @@ No modules.
## Authors ## Authors
Module managed by [Anton Babenko](https://github.com/antonbabenko). Module is maintained by [Anton Babenko](https://github.com/antonbabenko) with help from [these awesome contributors](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/graphs/contributors).
## License ## License
Apache 2 Licensed. See LICENSE for full details. Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/LICENSE) for full details.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment