mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 07:01:56 +03:00
04cc267e86
* codepipeline
12 lines
690 B
Bash
Executable File
12 lines
690 B
Bash
Executable File
#!/bin/bash
|
|
# set subnet, security groups, public ip
|
|
SERVICE_NAME=$1
|
|
CLUSTER_NAME=$1
|
|
NETWORK_CONFIGURATION=$(aws ecs describe-services --services $SERVICE_NAME --cluster $CLUSTER_NAME |jq -r '.services[].networkConfiguration')
|
|
SUBNETS=$(echo $NETWORK_CONFIGURATION |jq '.awsvpcConfiguration.subnets[]' | tr '\n' ',' | sed 's/.$//')
|
|
SECURITY_GROUPS=$(echo $NETWORK_CONFIGURATION |jq '.awsvpcConfiguration.securityGroups[]' | tr '\n' ',' | sed 's/.$//')
|
|
PUBLIC_IP=$(echo $NETWORK_CONFIGURATION |jq '.awsvpcConfiguration.assignPublicIp')
|
|
sed -i 's/$SUBNETS/'$SUBNETS'/' appspec.yaml
|
|
sed -i 's/$SECURITY_GROUPS/'$SECURITY_GROUPS'/' appspec.yaml
|
|
sed -i 's/$PUBLIC_IP/'$PUBLIC_IP'/' appspec.yaml
|