File tree Expand file tree Collapse file tree 5 files changed +37
-30
lines changed Expand file tree Collapse file tree 5 files changed +37
-30
lines changed Original file line number Diff line number Diff line change 55entrypoint=" $1 "
66command=" $2 "
77
8-
9- PREFIX=$( cat ../terraform/terraform.tfstate | jq ' .outputs.environment.value // empty' -r)
10- STAGE=$( cat ../terraform/terraform.tfstate | jq ' .outputs.stage.value // empty' -r)
11- ARCH=$( cat ../terraform/terraform.tfstate | jq ' .outputs.arch.value // empty' -r)
12-
13- if [ -z " $STAGE " ]
14- then
15- echo " STAGE must be set!"
16- exit 1;
17- fi
18-
19- if [ -z " $PREFIX " ]
20- then
21- echo " PREFIX must be set!"
22- exit 1;
23- fi
24-
25- if [ -z " $ARCH " ]
26- then
27- echo " ARCH must be set!"
28- exit 1;
29- fi
30-
31- CONTAINER=" $PREFIX -$STAGE -pdal_runner"
8+ CONTAINER=$( cat ../terraform/terraform.tfstate | jq ' .outputs.container.value // empty' -r)
329
3310REGION=$AWS_DEFAULT_REGION
3411if [ -z " $REGION " ]
4017LOCALPORT=9000
4118REMOTEPORT=8080
4219
43- identity=$( aws sts get-caller-identity --query ' Account' --output text)
44-
4520KEY_ID=$( aws --profile $AWS_DEFAULT_PROFILE configure get aws_access_key_id)
4621SECRET_ID=$( aws --profile $AWS_DEFAULT_PROFILE configure get aws_secret_access_key)
4722
4823
49- echo " running $identity .dkr.ecr. $region .amazonaws.com/ $ container: $ARCH "
24+ echo " Starting container $CONTAINER "
5025
5126if [ -z " $entrypoint " ]
5227then
5530 -e AWS_DEFAULT_REGION=$REGION \
5631 -e AWS_ACCESS_KEY_ID=${KEY_ID} \
5732 -e AWS_SECRET_ACCESS_KEY=${SECRET_ID} \
58- $identity .dkr.ecr. $REGION .amazonaws.com/ $ CONTAINER: $ARCH " $command "
33+ $CONTAINER " $command "
5934else
6035 echo " executing with $entrypoint and command '$command '"
6136 docker run -p $LOCALPORT :$REMOTEPORT \
6540 -t -i \
6641 -v $( pwd) :/data \
6742 --entrypoint=$entrypoint \
68- $identity .dkr.ecr.$REGION .amazonaws.com/$CONTAINER :$ARCH \
69- " $command "
43+ $CONTAINER " $command "
7044fi
7145
Original file line number Diff line number Diff line change 22
33eventfilename=$1
44
5+ if [ -z " $AWS_ACCESS_KEY_ID " ]
6+ then
7+ echo " AWS_ACCESS_KEY_ID must be set in environment!"
8+ exit 1;
9+ fi
10+
11+ if [ -z " $AWS_SECRET_ACCESS_KEY " ]
12+ then
13+ echo " AWS_SECRET_ACCESS_KEY must be set in environment!"
14+ exit 1;
15+ fi
16+
17+
518event=$( < $eventfilename )
619echo $event
720curl -POST -v " http://localhost:9000/2015-03-31/functions/function/invocations" -d @$eventfilename
Original file line number Diff line number Diff line change @@ -4,6 +4,17 @@ eventfilename=$1
44
55FUNCTION_NAME=$( cat ../terraform/terraform.tfstate | jq ' .outputs.info_lambda_name.value // empty' -r)
66
7+ if [ -z " $AWS_ACCESS_KEY_ID " ]
8+ then
9+ echo " AWS_ACCESS_KEY_ID must be set in environment!"
10+ exit 1;
11+ fi
12+
13+ if [ -z " $AWS_SECRET_ACCESS_KEY " ]
14+ then
15+ echo " AWS_SECRET_ACCESS_KEY must be set in environment!"
16+ exit 1;
17+ fi
718
819aws lambda invoke \
920 --function-name " $FUNCTION_NAME " \
Original file line number Diff line number Diff line change @@ -52,3 +52,8 @@ output "bucket" {
5252 description = " Storage bucket"
5353 value = module. resources . bucket
5454}
55+
56+ output "container" {
57+ description = " Container ARN"
58+ value = module. resources . container
59+ }
Original file line number Diff line number Diff line change @@ -47,3 +47,7 @@ data aws_ecr_image runner_image {
4747 image_tag = var. arch
4848 depends_on = [ null_resource. ecr_image , aws_ecr_repository . runner_ecr_repo ]
4949}
50+
51+ output "container" {
52+ value = " ${ aws_ecr_repository . runner_ecr_repo . repository_url } :${ var . arch } "
53+ }
You can’t perform that action at this time.
0 commit comments