Hi,
We have deployed an environment on Azure with Terraform. However, we have refactored Terraform templates to work with modules. Now, we are trying to build the new tfstate based on modules. We can import (with terraform import) without problems terraform builtin Azure resources but we don’t know how to “mark as done” the null_resources with local_provisioner configured that shouldn’t be executed anymore.
I.E: We want to “mark as done” tasks like the following one:
resource “null_resource” “databricks_ad_sync_token” {
depends_on = [
data.local_file.management_token,
data.local_file.application_token,
var.module_depends_on
]
triggers = {
trigger = timestamp()
}
provisioner “local-exec” {
command = <<EOT
curl -s --request POST ‘https://${var.region.name}.azuredatabricks.net/api/2.0/token/create’
–header ‘Content-Type: application/json’
–header ‘X-Databricks-Azure-Workspace-Resource-Id: /subscriptions/${data.azurerm_subscription.current.subscription_id}/resourceGroups/${var.resource_group_name}/providers/Microsoft.Databricks/workspaces/${var.databricks_ws_name}’
–header ‘X-Databricks-Azure-SP-Management-Token: ${jsondecode(data.local_file.management_token.content).access_token}’
–header ‘Authorization: Bearer ${jsondecode(data.local_file.application_token.content).access_token}’
–data-raw ‘{“comment”: “Additional token for synchronization with AD”}’
–output ‘${path.cwd}/.temp/databricks_ad_sync_token_data.txt’
EOT
}
}
So it’s imported to the new tfstate and doesn’t appear when doing terraform plan/apply as modified.
Anyone knows how to proceed? Any help is welcome.
Thanks in advance!
Best regards,
Albert.