- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2025 03:21 AM
Hi, I' m trying to create a terraform script that does the following:
- create a policy where I specify env variables and libraries
- create a cluster that inherits from that policy and uses the env variables specified in the policy.
I saw in the decumentation the command apply_policy_default_values that should allow me to set the env variables as defined under the policy definition, but it seems like it doesn't do that.
How can I get the desired behavior?
Here the code:
locals {
policy_environmental_variables = {
"spark_env_vars.VAR1" : {
"type": "fixed",
"value": var.environment == "value1" ? "" : "value2"
},
"spark_env_vars.VAR2": {
"type": "fixed",
"value": var.environment == "value1" ? "value1" : "value2",
}
"spark_env_vars.VAR3": {
"type": "fixed",
"value": var.environment == "value1" ? "value1" : "value2"
}
}
}
job_cluster {
job_cluster_key = "shared_job_cluster"
new_cluster {
num_workers = 2
spark_version = local.spark_version
node_type_id = "Standard_DS3_v2"
policy_id = databricks_cluster_policy.policy.id
apply_policy_default_values = true
}
}