build: remove dependency on pyenv-virtualenv (#7)

build: boto3 update, ensure terraform init
This commit is contained in:
Marc 2022-09-03 17:52:22 -04:00 committed by GitHub
parent 9a81426840
commit 08da99b99c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 30 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.venv
*.sw*
*.pyc
*.zip
@ -5,4 +6,4 @@
*.terraform*
*tfstate*
*tfvars
.coverage

View file

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# pip-compile requirements.in

View file

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# pip-compile --output-file=requirements_dev.txt requirements_dev.in
@ -16,14 +16,14 @@ aws-xray-sdk==2.6.0
# via moto
black==20.8b1
# via -r requirements_dev.in
boto3==1.16.59
boto==2.49.0
# via moto
boto3==1.24.66
# via
# -r requirements_dev.in
# aws-sam-translator
# moto
boto==2.49.0
# via moto
botocore==1.19.59
botocore==1.27.66
# via
# aws-xray-sdk
# boto3
@ -117,12 +117,12 @@ pyparsing==2.4.7
# via packaging
pyrsistent==0.17.3
# via jsonschema
pytest-cov==2.11.1
# via -r requirements_dev.in
pytest==6.2.1
# via
# -r requirements_dev.in
# pytest-cov
pytest-cov==2.11.1
# via -r requirements_dev.in
python-dateutil==2.8.1
# via
# botocore
@ -146,7 +146,7 @@ responses==0.12.1
# via moto
rsa==4.7
# via python-jose
s3transfer==0.3.4
s3transfer==0.6.0
# via boto3
six==1.15.0
# via

View file

@ -11,13 +11,12 @@ else
# of the invoke commands. #
#################################################################
{
pyenv virtualenv-delete -f $VENV
pyenv virtualenv $VENV &&
pyenv activate $VENV &&
python -m pip install -U pip pip-tools &&
pip install -r requirements_dev.txt &&
test -d $VENV || python3 -m venv $VENV || return
. $VENV/bin/activate
python -m pip install -U pip pip-tools --no-cache-dir
python -m pip install -r requirements.txt
python -m pip install -r requirements_dev.txt
echo "✨ Good to go! ✨"
}
fi

View file

@ -44,6 +44,7 @@ def cloud_plan(ctx, project):
Builds the Terraform plan for the given project.
"""
with ctx.cd(PROJECT_PATHS[project]):
ctx.run("terraform init")
ctx.run(f"terraform plan --var-file {VARIABLES_PATH}")
@ -53,6 +54,7 @@ def cloud_apply(ctx, project):
Applies infrastructure changes to the given project.
"""
with ctx.cd(PROJECT_PATHS[project]):
ctx.run("terraform init")
ctx.run("terraform taint --allow-missing aws_lambda_function.apgnd_lambda_func")
ctx.run("terraform taint --allow-missing aws_lambda_permission.apigw")
ctx.run(f"terraform apply --var-file {VARIABLES_PATH}")
@ -64,6 +66,7 @@ def cloud_destroy(ctx, project):
Destroys resources associated with the given project.
"""
with ctx.cd(PROJECT_PATHS[project]):
ctx.run("terraform init")
ctx.run(f"terraform destroy --var-file {VARIABLES_PATH}")
@ -90,8 +93,9 @@ def cloud_push(ctx, archive):
with ctx.cd(_compose_path(PROJECT_PATHS["bootstrap"])):
out = ctx.run("terraform output", hide="out").stdout
artifacts_bucket_match = re.match(
"artifacts_bucket_name = (?P<bucket_name>[0-9a-zA-Z\-]+)\n", out
'artifacts_bucket_name = "(?P<bucket_name>[0-9a-zA-Z-_]+)"\n?', out
)
artifacts_bucket = artifacts_bucket_match.group("bucket_name")
with ctx.cd(BASE_PATH):