From 1d1717a9438ca1b1c33d8a2be02335588de3f008 Mon Sep 17 00:00:00 2001 From: Bryan Alexander Date: Fri, 24 Jul 2020 15:28:54 -0500 Subject: [PATCH] adds additional outputs and fixes ineffectual err assignment --- files/run.sh | 12 ++++++++++++ lambda/app/app.go | 3 +++ outputs.tf | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/files/run.sh b/files/run.sh index 8c8b3f7..83106ce 100644 --- a/files/run.sh +++ b/files/run.sh @@ -12,6 +12,18 @@ aws s3 cp --region ${region} --recursive s3://${bucket}/ . aws s3 cp --region ${region} s3://${bucket}/files/id_rsa ${key_file} chown 400 ${key_file} +# aws s3 cp --region ${region} s3://${bucket}/files/python-xmltodict-0.9.0-1.el7.noarch.rpm python-xmltodict-0.9.0-1.el7.noarch.rpm +# rpm -i /tmp/python-xmltodict-0.9.0-1.el7.noarch.rpm + +# aws s3 cp --region ${region} s3://${bucket}/files/python2-ntlm-auth-1.1.0-1.el7.noarch.rpm python2-ntlm-auth-1.1.0-1.el7.noarch.rpm +# rpm -i /tmp/python2-ntlm-auth-1.1.0-1.el7.noarch.rpm + +# aws s3 cp --region ${region} s3://${bucket}/files/python2-requests_ntlm-1.1.0-1.el7.noarch.rpm python2-requests_ntlm-1.1.0-1.el7.noarch.rpm +# rpm -i /tmp/python2-requests_ntlm-1.1.0-1.el7.noarch.rpm + +# aws s3 cp --region ${region} s3://${bucket}/files/python2-winrm-0.3.0-1.el7.noarch.rpm python2-winrm-0.3.0-1.el7.noarch.rpm +# rpm -i /tmp/python2-winrm-0.3.0-1.el7.noarch.rpm + aws s3 cp --region ${region} s3://${bucket}/files/create_secrets.py create_secrets.py AWS_DEFAULT_REGION=${region} python create_secrets.py diff --git a/lambda/app/app.go b/lambda/app/app.go index 1a5e080..29d3c29 100644 --- a/lambda/app/app.go +++ b/lambda/app/app.go @@ -87,6 +87,9 @@ func (a *App) startup() error { } count, err := a.getInstanceCount(sess) + if err != nil { + return fmt.Errorf("failed to get ec2 instances: %v", err) + } if count == 0 { fmt.Println("There are no instances running, skipping ansible execution") return nil diff --git a/outputs.tf b/outputs.tf index b24f4cf..e9335e1 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,4 +3,16 @@ output "role_arn" { } output "profile_arn" { value = aws_iam_instance_profile.profile.arn +} +output "kms_key_arn" { + value = aws_kms_key.kms.arn +} +output "kms_key_alias" { + value = aws_kms_alias.kms.name +} +output "s3_bucket" { + value = aws_s3_bucket.bucket.id +} +output "lambda_arn" { + value = aws_lambda_function.lambda.arn } \ No newline at end of file