-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: shape our TF module scaffolding (#1)
Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
- Loading branch information
Showing
17 changed files
with
541 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
default: ci | ||
|
||
ci: | ||
scripts/ci_tests.sh | ||
|
||
release: ci | ||
scripts/release.sh prepare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Lacework, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Release Notes | ||
Release notes are automatically generated during a release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Default Example | ||
|
||
Every Terraform module must have one or more examples. | ||
|
||
```hcl | ||
terraform { | ||
required_providers { | ||
lacework = { | ||
source = "lacework/lacework" | ||
} | ||
} | ||
} | ||
provider "lacework" {} | ||
module "lacework_module" { | ||
source = "lacework/<NAME>/<PROVIDER>" | ||
version = "~> 0.1" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
provider "lacework" {} | ||
|
||
module "lacework_module" { | ||
source = "../.." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_version = ">= 0.12.26" | ||
|
||
required_providers { | ||
lacework = { | ||
source = "lacework/lacework" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Your Terraform code goes here :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#output "example" { | ||
# value = var.example | ||
# description = "This is just an example of an output" | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# | ||
# Name:: ci_tests.sh | ||
# Description:: Use this script to run ci tests of this repository | ||
# Author:: Salim Afiune Maya (<afiune@lacework.net>) | ||
# | ||
set -eou pipefail | ||
|
||
readonly project_name=terraform-<PROVIDER>-<NAME> | ||
|
||
TEST_CASES=( | ||
examples/default | ||
) | ||
|
||
log() { | ||
echo "--> ${project_name}: $1" | ||
} | ||
|
||
warn() { | ||
echo "xxx ${project_name}: $1" >&2 | ||
} | ||
|
||
integration_tests() { | ||
for tcase in ${TEST_CASES[*]}; do | ||
log "Running tests at $tcase" | ||
( cd $tcase || exit 1 | ||
terraform init | ||
terraform validate | ||
terraform plan | ||
) || exit 1 | ||
done | ||
} | ||
|
||
lint_tests() { | ||
log "terraform fmt check" | ||
terraform fmt -check | ||
} | ||
|
||
main() { | ||
lint_tests | ||
integration_tests | ||
} | ||
|
||
main || exit 99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
# | ||
# Name:: release.sh | ||
# Description:: Use this script to prepare a new release on Github, | ||
# the automation will create a GH tag like 'v0.1.0' | ||
# (using the VERSION file) | ||
# Author:: Salim Afiune Maya (<afiune@lacework.net>) | ||
# | ||
set -eou pipefail | ||
|
||
# common release functions | ||
source scripts/release_helpers.sh | ||
|
||
# Required Variables | ||
readonly org_name=lacework | ||
readonly project_name=terraform-<PROVIDER>-<NAME> | ||
readonly git_user="Lacework Inc." | ||
readonly git_email="ops+releng@lacework.net" | ||
readonly required_files_for_release=( | ||
RELEASE_NOTES.md | ||
CHANGELOG.md | ||
VERSION | ||
) | ||
readonly main_branch=main | ||
|
||
# Variable that changes during release | ||
VERSION=$(cat VERSION) | ||
|
||
usage() { | ||
local _cmd | ||
_cmd="$(basename "${0}")" | ||
cat <<USAGE | ||
${_cmd}: A tool that helps you do releases! | ||
Use this script to prepare a new Github release, the automation will generate | ||
release notes, update the changelog and create a Github tag like 'v0.1.0'. | ||
USAGE: | ||
${_cmd} [command] | ||
COMMANDS: | ||
prepare Generates release notes, updates version and CHANGELOG.md | ||
verify Check if the release is ready to be applied | ||
trigger Trigger a release by creating a git tag | ||
publish Creates a Github tag like 'v0.1.0' | ||
USAGE | ||
} | ||
|
||
main() { | ||
case "${1:-}" in | ||
prepare) | ||
prepare_release | ||
;; | ||
publish) | ||
publish_release | ||
;; | ||
verify) | ||
verify_release | ||
;; | ||
trigger) | ||
trigger_release | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
} | ||
|
||
main "$@" || exit 99 |
Oops, something went wrong.