build: remove dependency on pyenv-virtualenv (#7)
build: boto3 update, ensure terraform init
This commit is contained in:
parent
9a81426840
commit
08da99b99c
5 changed files with 34 additions and 30 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
*.venv
|
||||
*.sw*
|
||||
*.pyc
|
||||
*.zip
|
||||
|
@ -5,4 +6,4 @@
|
|||
*.terraform*
|
||||
*tfstate*
|
||||
*tfvars
|
||||
|
||||
.coverage
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
if [ "$CI" -eq 1 ]; then
|
||||
{
|
||||
python -m pip install -U pip pip-tools &&
|
||||
pip install -r requirements_dev.txt
|
||||
}
|
||||
else
|
||||
VENV=lambda-boilerplate.venv
|
||||
|
||||
#################################################################
|
||||
# Bootstrapping sets up the Python 3.8 venv that allows the use #
|
||||
# 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 &&
|
||||
echo "✨ Good to go! ✨"
|
||||
{
|
||||
python -m pip install -U pip pip-tools &&
|
||||
pip install -r requirements_dev.txt
|
||||
}
|
||||
else
|
||||
VENV=lambda-boilerplate.venv
|
||||
|
||||
#################################################################
|
||||
# Bootstrapping sets up the Python 3.8 venv that allows the use #
|
||||
# of the invoke commands. #
|
||||
#################################################################
|
||||
|
||||
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
|
||||
|
||||
|
|
6
tasks.py
6
tasks.py
|
@ -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):
|
||||
|
|
Reference in a new issue