Terraform Global Init Script base64encoding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2023 07:58 AM
I am working on converting manual global init scripts into a terraform IaC process for multiple environments. Within terraform, we are using the resource "databricks_global_init_script" and set the content_base64 with the following:
base64encoded(<<-EOT
#!/bin/bash
pip3 install pyodbc
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
apt-get update
ACCEPT_EULA=Y apt-get install msodbcsql17
pip3 install --upgrade pyodbc
EOT
)
However, when I call the rest api's to view the global init script to compare against my manual entry, the encoded base64 string is different. The version terraform is creating is not working. Why would terraform be creating a different encoded base64 string?
- Labels:
-
Global Init Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 03:47 PM
I am looking into it @Kristian Foster
Are you able to get it working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 04:39 AM
My work around is to edit and resave what terraform is creating, which is not ideal. This is the only way I can get the base64encoded string to be correct.

