External Resources module to provision and manage Elasticache clusters in AWS with app-interface.
- Terraform
- AWS provider
- Random provider
- Python 3.12
- Pydantic
Prepare your local development environment:
make dev
See the Makefile
for more details.
To update the Terraform modules used in this project, bump the version in versions.tf and update the Terraform lockfile via:
make providers-lock
- Make changes to the code.
- Build the image with
make build
. - Run the image manually with a proper input file and credentials. See the Debugging section below.
- Please don't forget to remove (
-e ACTION=Destroy
) any development AWS resources you create, as they will incur costs.
To debug and run the module locally, run the following commands:
# setup the environment
$ export VERSION=$(grep konflux.additional-tags Dockerfile | cut -f2 -d\")
$ export IMAGE=quay.io/redhat-services-prod/app-sre-tenant/er-aws-elasticache-main/er-aws-elasticache-main:$VERSION
# Get the input file from app-interface
qontract-cli --config=<CONFIG_TOML> external-resources --provisioner <AWS_ACCOUNT_NAME> --provider elasticache --identifier <IDENTIFIER> get-input > tmp/input.json
# Get the AWS credentials
$ qontract-cli --config=<CONFIG_TOML> external-resources --provisioner <AWS_ACCOUNT_NAME> --provider elasticache --identifier <IDENTIFIER> get-credentials > tmp/credentials
# Run the stack
$ docker run --rm -it \
--mount type=bind,source=$PWD/tmp/input.json,target=/inputs/input.json \
--mount type=bind,source=$PWD/tmp/credentials,target=/credentials \
--mount type=bind,source=$PWD/tmp/work,target=/work \
-e DRY_RUN=True \
-e ACTION=Apply \
"$IMAGE"