Thanks for contributing!
- Access to the Formidable AWS account (or your own if you're an external contributor).
aws-vault
. Follow these instructions to install and set up your profile.- ℹ️ Note: You must either specify an AWS region in local configuration (e.g.
~/.aws/*
files) or via theAWS_REGION
environment variable.
- ℹ️ Note: You must either specify an AWS region in local configuration (e.g.
- Terraform and
tfenv
.tfenv
conflicts with Homebrewterraform
, so uninstall it before proceeding. In the root of the repo, runbrew install tfenv && tfenv install
.tfenv
will download and install the Terraform version pinned in.terraform-version
. golangci-lint
for linting Go code. Install withbrew install golangci/tap/golangci-lint
.
We have an example Terraform config for the provider at example-test.tf
. This config has access to the custom provider binary. To manually test provider changes with this config, here's a sample workflow to kick the tires variously:
# First, start with a vault-enhanced shell for easier work.
$ AWS_REGION={SET_A_REGION} aws-vault exec --no-session {ACCOUNT_NAME}
export PS1="\[\e[01;31m\][aws-vault] $\[\e[00m\] "
# Apply changes (causing serverless deploy)
# To see debug logs, run `TF_LOG=debug terraform apply` instead.
[aws-vault] $ go build -o terraform-provider-serverless
[aws-vault] $ terraform init
[aws-vault] $ terraform apply
# Verify running serverless / lambda app and get endpoint URL
[aws-vault] $ ( cd example && serverless info -s sandbox )
Service Information
...
endpoints:
GET - https://l79poa98qe.execute-api.us-east-1.amazonaws.com/sandbox/ping
...
# Apply changes and verify deployment doesn't change unless source / `node_modules` change
[aws-vault] $ terraform apply
# From here you can either change source JS or deps to verify a new deploy
# happens, or skip to the last step of tearing down the serverless app.
[aws-vault] $ terraform destroy
# Verify serverless app is gone
[aws-vault] $ ( cd example && serverless info -s sandbox )
Serverless Error ---------------------------------------
Stack with id sls-provider-sandbox does not exist
...
# Exit vault-enhanced shell
[aws-vault] $ exit
Terraform infers log levels from string prefixes. To log values from the provider, you can use:
log.Println("[WARN]", value)
You can then use TF_LOG=warn
before terraform apply
or make testacc
to see your logs.
We lint the the codebase with golangci-lint
. To lint:
make lint
To run acceptance tests:
$ AWS_REGION={SET_A_REGION} aws-vault exec --no-session {ACCOUNT_NAME} -- \
make testacc
- Run lint and the acceptance tests listed above.
- Run
make fmt
to format your code! CI will catch this, but it'll save you a build!
- Update
CHANGELOG.md
, following format for previous versions - Commit as "Changes for version NUMBER"
- Tag a version in git master branch after merging the PRs you want to release. E.g.
git tag -a "v1.2.3" -m "1.2.3"
- Run
git push && git push --tags
After a git tag is pushed, a Travis deploy
step will use Goreleaser to build cross-platform binaries and place them in a GitHub release automatically.