我有一个返回NLB cname的bash脚本。我想将返回的cname用作我的api-gateway集成的输入。
我正在将这个代码部署在terraform模板中:
#!/bin/bash
nlbcname=$(aws-env terraform output nlb_arn | grep arn | awk '$1=$1' FS="/" OFS=":" | awk 'BEGIN{ VAR1="elb";VAR2="amazonaws.com"; FS=":"; OFS="."} {print $8,$9,VAR1,$4,VAR2}' | sed -e 's/\./-/')
echo -n "{\"nlburl\":\"${nlbcname}\"}"
但是我明白了
Error refreshing state: 1 error occurred:
* data.external.nlbcname: 1 error occurred:
* data.external.nlbcname: data.external.nlbcname: command "bash" produced invalid JSON: invalid character '\r' in string literal