I have some job notifications setup via MS Teams URL. Tried to export the entire workspace even with the -export-secrets option but in the config files generated under the settings.tf file, the URL variables have been assigned but the values of the variables have not been generated. Do I have to manually enter them or is there any way to get the exporter to generate those values also?
resource "databricks_notification_destination" "example1" { display_name = "Platform Example"
config {
microsoft_teams {
url = var.config_example1
}
}
}
Tried using the -export-secrets option but to no avail.
I have some job notifications setup via MS Teams URL. Tried to export the entire workspace even with the -export-secrets option but in the config files generated under the settings.tf file, the URL variables have been assigned but the values of the variables have not been generated. Do I have to manually enter them or is there any way to get the exporter to generate those values also?
resource "databricks_notification_destination" "example1" { display_name = "Platform Example"
config {
microsoft_teams {
url = var.config_example1
}
}
}
Tried using the -export-secrets option but to no avail.
Share Improve this question edited Feb 6 at 9:37 Jahnavi 7,9231 gold badge6 silver badges12 bronze badges Recognized by Microsoft Azure Collective asked Feb 5 at 11:57 KerbecsKerbecs 11 bronze badge 5 |1 Answer
Reset to default 0Do I have to manually enter them or is there any way to get the exporter to generate those values also?
There are a couple of approaches you can follow here to retrieve the notification secret value. Firstly, you can visit the workspace path Databricks workspace >> settings >> Notifications >> Url
and copy the specific team's notifications URL. Now store that secret value in a variable using terraform variable block and access the value in the code.
variable "urlval" {
type = string
default = "https://outlook.office.com/"
}
Note: To access and retrieve the value in the main.tf
, you can use var.urlval
.
Alternatively, you can use databricks_secret
resource available in Terraform.
With this resource you can insert a secret under the provided scope with the given name.
First step is to store the secret value in a key vault secret as shown below by setting up the expiration date as per your requirement.
terraform {
required_providers {
databricks = {
source = "databricks/databricks"
version = "1.65.1"
}
}
}
provider "databricks" {
features{}
}
provider "azurerm"{
features{}
subscription_id="xxxx"
}
data "azurerm_key_vault" "example" {
name = "carokeyv"
resource_group_name = "caronew"
}
data "azurerm_key_vault_secret" "example" {
name = "databrickssecret"
key_vault_id = data.azurerm_key_vault.example.id
}
resource "databricks_secret_scope" "scope" {
name = "xxxx"
}
resource "databricks_secret" "secret" {
key = "MicrosoftTeams"
string_value = data.azurerm_key_vault_secret.example.value
scope = databricks_secret_scope.scope.id
}
output "notification_url" {
value = nonsensitive(databricks_secret.secret.string_value)
}
Note: You can store it in the databricks_secret
resource or directly reference the value from the key vault secret.
resource "databricks_notification_destination" "example1" { display_name = "Platform Example" config { microsoft_teams { url = var.config_example1 } } }
Now what I want is the var.config_example1 value to be generated by the exporter as well.variable "config_example1" { description = "" }
This is how it looks like in my vars.tf and the value for the same isn't present in terraform.tfvars file also. I am quite new to Terraform so sorry if I can't explain much better. @Jahnavi – Kerbecs Commented Feb 6 at 4:18databricks_secret_resource
? @Kerbecs – Jahnavi Commented Feb 7 at 12:48