Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: clowdhaus/terraform-min-max
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.0
Choose a base ref
...
head repository: clowdhaus/terraform-min-max
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.1
Choose a head ref
  • 3 commits
  • 23 files changed
  • 3 contributors

Commits on Nov 12, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3411591 View commit details
  2. fix: Add sort ascending by string length in versions.tf files keys ar…

    …ray (#15)
    
    Co-authored-by: Juan Ramón Sixto Anello <5945892+jotasixto@users.noreply.github.com>
    bryantbiggs and jotasixto authored Nov 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8250970 View commit details
  3. chore(release): version 1.2.1 [skip ci]

    ## [1.2.1](v1.2.0...v1.2.1) (2022-11-12)
    
    ### Bug Fixes
    
    * Add sort ascending by string length in versions.tf files keys array ([#15](#15)) ([8250970](8250970))
    semantic-release-bot committed Nov 12, 2022
    Copy the full SHA
    3c5b175 View commit details
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -17,13 +17,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

66 changes: 40 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -9,42 +9,56 @@ on:
- main

jobs:
versionExtract:
name: Extract Min/Max Versions
collectInputs:
name: Collect workflow inputs
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.dirs.outputs.directories }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Extract Terraform min/max versions
id: minMax
uses: ./
with:
directory: tests/0.13
outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
- name: Get root directories
id: dirs
uses: clowdhaus/terraform-composite-actions/directories@v1.3.0

versionEvaluate:
name: Evaluate Min/Max Versions
preCommit:
name: Pre-commit
needs: collectInputs
runs-on: ubuntu-latest
needs: versionExtract
strategy:
matrix:
version:
- ${{ needs.versionExtract.outputs.minVersion }}
- ${{ needs.versionExtract.outputs.maxVersion }}
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Terraform min/max versions
id: minMax
uses: ./
with:
directory: ${{ matrix.directory }}

# Min version
- name: Remove default Terraform
run: rm -rf $(which terraform)

- name: Install Terraform ${{ steps.minMax.outputs.minVersion }}
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ steps.minMax.outputs.minVersion }}

- name: Terraform validate ${{ steps.minMax.outputs.minVersion }}
run: terraform init && terraform validate

# Max version
- name: Remove min Terraform
run: rm -rf $(which terraform)

- name: Install Terraform v${{ matrix.version }}
uses: hashicorp/setup-terraform@v1
- name: Install Terraform ${{ steps.minMax.outputs.maxVersion }}
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.version }}
terraform_version: ${{ steps.minMax.outputs.maxVersion }}

- name: Initialize and validate v${{ matrix.version }}
run: |
cd tests/0.13
terraform init
terraform validate
- name: Terraform validate ${{ steps.minMax.outputs.maxVersion }}
run: terraform init && terraform validate
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.2.1](https://github.com/clowdhaus/terraform-min-max/compare/v1.2.0...v1.2.1) (2022-11-12)


### Bug Fixes

* Add sort ascending by string length in versions.tf files keys array ([#15](https://github.com/clowdhaus/terraform-min-max/issues/15)) ([8250970](https://github.com/clowdhaus/terraform-min-max/commit/8250970624bba09f5d3e3b396c9cd0f521b8220b))

# [1.2.0](https://github.com/clowdhaus/terraform-min-max/compare/v1.1.1...v1.2.0) (2022-10-27)


2 changes: 1 addition & 1 deletion src/search.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ const regExprRequiredVersion = /(?<=(required_version.=.)).*/;

export async function versionConstraintSearch(dir: string): Promise<string> {
const files = await findInFiles.find('required_versions*s*', dir, '.tf$');
const key = Object.keys(files)[0];
const key = Object.keys(files).sort((a, b) => a.length - b.length)[0];
const line = files[key].line;

if (line) {
32 changes: 32 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.DS_Store

# Local .terraform directories
**/.terraform/*

# Terraform lockfile
.terraform.lock.hcl

# .tfstate files
*.tfstate
*.tfstate.*
*.tfplan

# Crash log files
crash.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore CLI configuration files
.terraformrc
terraform.rc
7 changes: 7 additions & 0 deletions tests/0.12/main.tf → tests/0.12/versions.tf
Original file line number Diff line number Diff line change
@@ -5,4 +5,11 @@ provider "aws" {

terraform {
required_version = "~> 0.12"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.27"
}
}
}
2 changes: 1 addition & 1 deletion tests/0.13/main.tf → tests/0.13/versions.tf
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.9"
version = ">= 4.27"
}
}
}
Loading