stocky-petabyte-29883
08/09/2022, 8:50 AMconst setEnvVarsCommand = new remote.Command("set-env-vars", {connection,
create: pulumi.interpolate`echo "export MASTER_USER='"test"'\nexport MASTER_PASSWORD='test'\nexport DB_USERNAME='test'\nexport DB_PASSWORD='test'\nexport DB_NAME='test'\nexport DB_HOST='test'" >> ~/.bashrc && source ~/.bashrc && echo "AcceptEnv MASTER_USER MASTER_PASSWORD DB_USERNAME DB_PASSWORD DB_NAME DB_HOST" | sudo tee -a /etc/ssh/sshd_config && sudo service sshd restart`,
delete: `head -n -6 ~/.bashrc > tmp_file && mv tmp_file ~/.bashrc && head -n -1 ~/.bashrc > tmp_sshd && sudo mv tmp_sshd /etc/ssh/sshd_config`
}, { dependsOn: remoteFile });
new remote.Command("mysql-setup-execute", {connection,
create: pulumi.interpolate`chmod 777 ./mysql-setup.sh; ./mysql-setup.sh`,
delete: "rm mysql-setup.sh",
environment: {
MASTER_USER: masterUsername,
MASTER_PASSWORD: masterPassword!,
DB_USERNAME: dbUsername,
DB_PASSWORD: dbUserPassword,
DB_NAME: dbName,
DB_HOST: dbHost
}
}, { dependsOn: setEnvVarsCommand });
I am dumping all the env variables available in the mysql-setup.sh file and the environment variables have the place holder value test which I setup in the first remote command, I am not able to override it.
I went with AcceptEnv as people recommended it in the issue https://github.com/pulumi/pulumi-command/issues/48
I am stuck here and need some helpNo 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