terraform tips - ghdrako/doc_snipets GitHub Wiki
It is considered a best practice to keep depends_on
usage to a minimum and let Terraform figure out the dependencies as much as
possible, as overuse of depends_on
can slow down execution.
Base64 is a way to encode data into a continuous string of ASCII text; it helps post-multi-line scripts or binary data to APIs.
user_data = base64encode(templatefile("vm-cloud-init-admin.yml.tftpl", {
tmpl_database_username = "${var.database_administrator_login}"
tmpl_database_password = "${random_password.database_admin_password.result}"
tmpl_database_hostname = "${azurecaf_name.mysql_flexible_server.result}.${replace(var.name, "-", "")}.mysql.database.azure.com"
tmpl_database_name = "${azurerm_mysql_flexible_database.wordpress_database.name}"
tmpl_file_share = "${azurerm_storage_account.sa.name}.file.core.windows.net:/${azurerm_storage_account.sa.name /${azurerm_storage_share.nfs_share.name}"
tmpl_wordpress_url = "http://${azurerm_public_ip.load_balancer.ip_address}"
tmpl_wp_title = "${var.wp_title}"
tmpl_wp_admin_user = "${var.wp_admin_user}"
tmpl_wp_admin_password = "${random_password.wordpress_admin_password.result}"
tmpl_wp_admin_email = "${var.wp_admin_email}"
}))
}