Skip to content

Commit

Permalink
fix(tests): adding tests (#16)
Browse files Browse the repository at this point in the history
improving internal testing of module to comply with new standards
  • Loading branch information
SebRosander authored Mar 6, 2023
1 parent a7a3f38 commit 86c841a
Show file tree
Hide file tree
Showing 40 changed files with 204 additions and 402 deletions.
8 changes: 8 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See rules: https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md
extends:
- '@commitlint/config-conventional'
rules:
subject-case: [ 1, 'always', 'lower-case' ] # Warn but don't error on subject-case
subject-full-stop: [ 0, 'never', '.' ] # Disable error on subject-full-stop
body-max-line-length: [ 2, 'always', 'Infinity' ]
footer-max-line-length: [ 1, 'always', 100 ] # Warn but don't error on footer length because it's silly
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @isasand @twiden @SebRosander @marcmodin
* @playgroundtech/owners
27 changes: 27 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
pre-commit:
name: Pre-Commit
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Update Repo
run: brew update
- name: Install Deps
run: brew install pre-commit gitleaks tflint tfsec terraform-docs terraform || true
- name: Terraform init
run: terraform init
- name: Check Pre Commit
run: pre-commit run --show-diff-on-failure -a

name: PR checks
on:
- pull_request
21 changes: 21 additions & 0 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
jobs:
semver-release:
name: Semantic Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
with:
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
semantic_version: 17
name: Release
on:
push:
branches:
- master
34 changes: 0 additions & 34 deletions .github/workflows/terraform-fmt.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/terraform-validate.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/terratest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
defaults:
run:
shell: bash
working-directory: test
working-directory: tests

steps:
# Checkout the repository to the GitHub Actions runner
Expand All @@ -36,11 +36,13 @@ jobs:
# Install and set up Golang
- name: Set Up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.x

# Get all golang dependencies
- name: Get dependencies
run: go mod tidy

# Run terratest
- name: Run Terratest
run: go test -timeout 90m
run: go test -timeout 90m
40 changes: 0 additions & 40 deletions .github/workflows/tflint.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/tfsec.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ override.tf.json
*tfplan*

# IntelliJ IDEA
*.idea
*.idea
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.1
hooks:
- id: terraform_fmt
- id: terraform_validate
- id: terraform_docs
- id: terraform_tfsec
- 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_module_pinned_source'
- '--args=--only=terraform_naming_convention'
- '--args=--only=terraform_workspace_remote'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: check-json
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: https://github.com/zricethezav/gitleaks
rev: v8.16.0
hooks:
- id: gitleaks
19 changes: 19 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ci: true
debug: false
plugins:
- - '@semantic-release/commit-analyzer'
- preset: angular
- - '@semantic-release/release-notes-generator'
- preset: angular
writerOpts:
commitsSort:
- subject
- scope
- '@semantic-release/github'
publish:
- '@semantic-release/github'
repositoryUrl: https://github.com/playgroundtech/terraform-aws-github-actions-oidc
verifyConditions:
- '@semantic-release/github'
branches:
- master
5 changes: 0 additions & 5 deletions .tflint.hcl

This file was deleted.

23 changes: 19 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
# v2.0.1

Internal refactoring of the module to comply with new standards.

FEATURES

ENHANCEMENTS

* Several tests added to the module.

BUG FIXES

# v2.0.0

The release contains breaking changes, be careful when you update your module
since it may involve downtime with a changed behavior of network traffic.
since it may involve downtime with a changed behavior of network traffic.

FEATURES

ENHANCEMENTS
* Complete rework of how we handle NAT Gateways.

* Complete rework of how we handle NAT Gateways.
Now supports HA solutions and are deployed over all given availability zones.

* Added variable `nat_route_table` to make it possible to choose wether to
create own route tables or let the module create them for you.

BUG FIXES


# v1.0.0

FEATURES

* Release of v1.0.0

ENHANCEMENTS
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,4 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------

This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
defined by the Mozilla Public License, v. 2.0.
2 changes: 1 addition & 1 deletion internet_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ resource "aws_route_table_association" "igw" {
for_each = local.public_subnets
route_table_id = aws_route_table.igw[0].id
subnet_id = aws_subnet.subnets[each.key].id
}
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = "~> 1.0"
}
}
2 changes: 1 addition & 1 deletion subnets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ resource "aws_subnet" "subnets" {
},
var.vpc_tags
)
}
}
15 changes: 0 additions & 15 deletions test/nwk_bybits/main.tf

This file was deleted.

2 changes: 0 additions & 2 deletions test/nwk_bybits/variables.tf

This file was deleted.

15 changes: 0 additions & 15 deletions test/nwk_bycidr/main.tf

This file was deleted.

2 changes: 0 additions & 2 deletions test/nwk_bycidr/variables.tf

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 86c841a

Please sign in to comment.