sparse-intern-71089
08/20/2019, 9:54 PMalert-beard-9601
08/20/2019, 9:55 PM= aws:ec2/instance:Instance: (import)
[id=i-0fd1d213dcf923405]
[urn=urn:pulumi:qa::peopleticker::aws:ec2/instance:Instance::redis]
[provider=urn:pulumi:qa::peopleticker::pulumi:providers:aws::default_0_18_27::5506e064-4ed2-477b-a936-fc0ed79587cf]
~ userData: "30621d02b5ac13e6f64317c24a64c73d15c3ca1a" => "30621d02b5ac13e6f64317c24a64c73d15c3ca1a"
alert-beard-9601
08/20/2019, 9:55 PMalert-beard-9601
08/20/2019, 9:57 PM$PASSWORD
for obvious reasons
const existingUserData = `Content-Type: multipart/mixed; boundary="MIMEBOUNDARY"
MIME-Version: 1.0
--MIMEBOUNDARY
Content-Disposition: attachment; filename="setup.cnf"
Content-Transfer-Encoding: 7bit
Content-Type: text/x-shellscript
Mime-Version: 1.0
#!/bin/bash -x
service redis-server stop
sed -i 's/^bind 127.0.0.1/bind 0.0.0.0/' /etc/redis/redis.conf
# Protect
if [[ 0 == "1" ]]; then
sed -i 's/^# requirepass foobared/requirepass "$PASSWORD"/' /etc/redis/redis.conf
fi
# Do not protect
if [[ 0 == "0" ]]; then
sed -i 's/^protected-mode yes/protected-mode no/' /etc/redis/redis.conf
fi
service redis-server start
--MIMEBOUNDARY--
`;
const redisInstance = new aws.ec2.Instance(
"redis",
{
ami: tfRedisConfig.amiId,
instanceType: tfRedisConfig.instanceType,
subnetId: tfRedisConfig.subnetId,
vpcSecurityGroupIds:[tfRedisSg.id],
associatePublicIpAddress: false,
userData: existingUserData,
tags: {
Name: `${tfRedisConfig.name}-redis-${tfRedisConfig.env}-${tfRedisConfig.awsRegion}`,
Region: tfRedisConfig.awsRegion,
Env: tfRedisConfig.env
}
},
{
import: "i-0fd1d213dcf923405",
deleteBeforeReplace: false
}
);
alert-beard-9601
08/20/2019, 9:57 PMadamant-dress-73325
08/20/2019, 11:26 PMaws ec2 describe-instance-attribute --instance-id INSTANCE_ID --attribute userData | jq '.UserData.Value' - -r | base64 -D | pbcopy
to grab exact value for user data.white-balloon-205
{ ignoreChanges: [“userData”] }
in the resource options to skip any perceived changes to the userData. You then can’t update this property via Pulumi (unless you remove the ignoreChanges) but that might be what you want here.alert-beard-9601
08/21/2019, 3:33 PMNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by