aws-samples / aws-samples/aws-proton-terraform-github-actions-sample

GH Actions exits abnormally at the Notify Proton step

Open
#17 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HCL
Stars
16
Forks
36
PR merge metrics
No merged PRs in 30d

Description

I am trying to leverage these GH Actions for a template I am using to define an EKS cluster. The deployment of the resources seems to complete successfully but at the time of notifying Proton the script exits with a syntax error on the aws cli call:
```
# Get outputs as json
outputs_json=$(terraform output -json)

# The outputs parameters expects a list of key=keyName,valueString=value key=key2Name,valueString=value2 etc...
# So here we convert the output json into a shell array
# NOTE: This will probably not play nicely with complex output objects (non primitives)

formatted_outputs=( $(echo $outputs_json | jq -r "to_entries|map(\"key=\(.key),valueString=\(.value.value|tostring)\")|.[]") )

# Notify proton
aws proton notify-resource-deployment-status-change --region us-west-2 --resource-arn arn:aws:proton:us-west-2:***:environment/myeks --status SUCCEEDED --deployment-id 4bc18b1d-a802-4dcd-8199-246177142027 --outputs ${formatted_outputs[*]}
echo "Notify success!"
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
AWS_DEFAULT_REGION: us-west-2
AWS_REGION: us-west-2
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_SESSION_TOKEN: ***

usage: aws [options] [ ...] [parameters]
To see help text, you can run:

aws help
aws help
aws help

Unknown options: --name, myeks

Error: Process completed with exit code 252.
```

Contributor guide

Open the contributing guide

Research direction

Start at the GitHub Actions step containing the Notify Proton shell command and inspect how Terraform outputs become formatted_outputs and are passed to aws proton notify-resource-deployment-status-change. Re-run the workflow or an equivalent AWS CLI invocation; done means the notification succeeds without the unknown-option error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, bash, github-actions, terraform
Domain
ci-cd, cloud, devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.