Reputation: 158
not getting the value from find in map
UserData: !Base64
'Fn::Join':
- |+
- - '#!/bin/bash'
- !Sub sudo -u $SPLUNK_USER $SPLUNK_BIN init shcluster-config
-mgmt_uri https://$LOCALIP:8089 -replication_port 8090 -replication_factor !FindInMap[SplunkConfig, shcluster-replication-factor, num]
-conf_deploy_fetch_url https://${SplunkSHCDeployer.PrivateIp}:8089 -shcluster_label SplunkSHC
-secret ${SplunkClusterSecret} -auth admin:${SplunkAdminPassword}
Upvotes: 0
Views: 161
Reputation: 158
UserData: !Base64
'Fn::Join':
- |+
- - '#!/bin/bash'
- !Join
- - export $a=
- !FindInMap[SplunkConfig, shcluster-replication-factor, num]
- !Sub sudo -u $SPLUNK_USER $SPLUNK_BIN init shcluster-config
-mgmt_uri https://$LOCALIP:8089 -replication_port 8090 -replication_factor $a
-conf_deploy_fetch_url https://${SplunkSHCDeployer.PrivateIp}:8089 -shcluster_label SplunkSHC
-secret ${SplunkClusterSecret} -auth admin:${SplunkAdminPassword}
That worked for me.
Upvotes: 0
Reputation: 43671
You'll be much better off using Sub
instead of Join
.
For !FindInMap[SplunkConfig, shcluster-replication-factor, num]
, you'll need to specify it as a parameter to Sub
.
You'll probably have something like:
UserData: !Base64
'Fn::Sub':
- |
Content-Type: multipart/mixed; boundary="==BOUNDARY=="
MIME-Version: 1.0
--==BOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
sudo -u $SPLUNK_USER $SPLUNK_BIN init shcluster-config -mgmt_uri https://$LOCALIP:8089 -replication_port 8090 -replication_factor ${ReplicationFactor} -conf_deploy_fetch_url https://${SplunkSHCDeployer.PrivateIp}:8089 -shcluster_label SplunkSHC -secret ${SplunkClusterSecret} -auth admin:${SplunkAdminPassword}
--==BOUNDARY==--
- ReplicationFactor: !FindInMap[SplunkConfig, shcluster-replication-factor, num]
Upvotes: 1