Skip to content

Commit

Permalink
adds additional outputs and fixes ineffectual err assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlalexander committed Jul 24, 2020
1 parent fe94ca1 commit 1d1717a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions files/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lambda/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 1d1717a

Please sign in to comment.