Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Synapse Linked Service error: produced an unexpected new value: Root resource was present, but now absent #17646

Closed
1 task done
StickNitro opened this issue Jul 15, 2022 · 11 comments · Fixed by #19636
Closed
1 task done

Comments

@StickNitro
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

I am trying to setup a PowerBI Synapse Link between Cosmos DB and a Synapse Workspace, terraform included below. I am creating an Azure Cosmos DB account and a Synapse Workspace then creating a azurerm_synapse_linked_service however on applying the configuration I am getting this error:

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to azurerm_synapse_linked_service.cosmos, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

It is possible that I have not configured the resource correctly but everything looks to be correct, it is also possible that this is either not the correct resource or what I am trying to setup is not supported

Terraform Version

1.2.4

AzureRM Provider Version

2.99.0

Affected Resource(s)/Data Source(s)

azurerm_synapse_linked_service

Terraform Configuration Files

terraform {
  required_version = "~>1.2.0"
  required_providers {
    azurerm = {
      version = "2.99.0"
    }
    random = {
      version = "3.3.2"
    }
  }
}

provider "azurerm" {
  skip_provider_registration = true
  subscription_id            = "ea80ce6b-d4af-44da-b2c1-af925fd21360"
  features {
  }
}

locals {
  tags = {
    DataPermanence = "Temporary"
  }
}

resource "azurerm_resource_group" "rg" {
  name     = "rg-powerbi-dashboard"
  location = "uksouth"

  tags = local.tags
}

resource "azurerm_storage_account" "synapse" {
  name                     = "stpbidsynapse"
  resource_group_name      = azurerm_resource_group.rg.name
  location                 = azurerm_resource_group.rg.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
  is_hns_enabled           = true

  tags = local.tags
}

resource "random_password" "workspace_password" {
  length = 16
}

resource "azurerm_storage_data_lake_gen2_filesystem" "synapse" {
  name               = "stdl-powerbi-uksouth"
  storage_account_id = azurerm_storage_account.synapse.id
}

resource "azurerm_synapse_workspace" "synapse" {
  name                                 = "synw-powerbi-uksouth"
  resource_group_name                  = azurerm_resource_group.rg.name
  location                             = azurerm_resource_group.rg.location
  storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.synapse.id
  sql_administrator_login              = "sqladminuser"
  sql_administrator_login_password     = random_password.workspace_password.result

  # identity {
  #   type = "SystemAssigned"
  # }

  tags = local.tags
}

resource "azurerm_cosmosdb_account" "cosmos" {
  name                = "cosmos-powerbi-uksouth"
  resource_group_name = azurerm_resource_group.rg.name
  location            = azurerm_resource_group.rg.location
  offer_type          = "Standard"

  analytical_storage_enabled = true

  backup {
    type                = "Periodic"
    interval_in_minutes = 240
    retention_in_hours  = 8
    storage_redundancy  = "Geo"
  }

  geo_location {
    location          = azurerm_resource_group.rg.location
    failover_priority = 0
  }

  geo_location {
    location          = "ukwest"
    failover_priority = 1
  }

  consistency_policy {
    consistency_level       = "Session"
    max_interval_in_seconds = 5
    max_staleness_prefix    = 100
  }

  tags = local.tags
}

resource "azurerm_cosmosdb_sql_database" "cosmos" {
  name                = "powerbi"
  resource_group_name = azurerm_resource_group.rg.name
  account_name        = azurerm_cosmosdb_account.cosmos.name

  throughput = 400
}

resource "azurerm_cosmosdb_sql_container" "cosmos" {
  name = "items"
  resource_group_name = azurerm_resource_group.rg.name
  account_name = azurerm_cosmosdb_account.cosmos.name
  partition_key_path = "/pk"
  database_name = azurerm_cosmosdb_sql_database.cosmos.name
}

resource "azurerm_synapse_firewall_rule" "synapse" {
  name                 = "allowAll"
  synapse_workspace_id = azurerm_synapse_workspace.synapse.id
  start_ip_address     = "0.0.0.0"
  end_ip_address       = "255.255.255.255"
}

resource "azurerm_synapse_linked_service" "cosmos" {
  name                 = "synsv-powerbi-uksouth"
  synapse_workspace_id = azurerm_synapse_workspace.synapse.id
  type                 = "Azure Cosmos DB (SQL API)"
  type_properties_json = <<JSON
{
  "connectionString": "${azurerm_cosmosdb_account.cosmos.connection_strings[0]}Database=${azurerm_cosmosdb_sql_database.cosmos.name}"
}
JSON

  depends_on = [
    azurerm_synapse_firewall_rule.synapse
  ]
}

output "synapse_admin_password" {
  value     = random_password.workspace_password.result
  sensitive = true
}

output "cosmos_connection_string" {
  value     = azurerm_cosmosdb_account.cosmos.connection_strings[0]
  sensitive = true
}

Debug Output/Panic Output

Error: Provider produced inconsistent result after apply
│
│ When applying changes to azurerm_synapse_linked_service.cosmos, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Expected Behaviour

terraform should have completed without an error

Actual Behaviour

Get the following error when applying terraform

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to azurerm_synapse_linked_service.cosmos, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@StickNitro StickNitro added the bug label Jul 15, 2022
@github-actions github-actions bot removed the bug label Jul 15, 2022
@tmiroslav
Copy link

tmiroslav commented Jul 15, 2022

I am facing same issue, but just on another service:

When applying changes to
module.bmaas["eastus"].azurerm_private_dns_zone_virtual_network_link.bmaas[0],
provider "registry.terraform.io/hashicorp/azurerm" produced an unexpected new
value: Root resource was present, but now absent.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.
TERRAFORM_VERSION=0.14.11
provider_azurerm: 3.14.0

@josejfb
Copy link

josejfb commented Jul 18, 2022

Same here. Trying to create a link service from Synapse to a storage account with a private endpoint but getting the same error.

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to azurerm_synapse_linked_service.synapse_link_storage, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
TERRAFORM_VERSION=1.2.5
required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=3.12.0"
    }
}

@jagbonkh
Copy link

facing the same issue
Error: Provider produced inconsistent result after apply │ │ When applying changes to │ module.site-gho.azurerm_synapse_linked_service.des-linked-service, provider │ "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an │ unexpected new value: Root resource was present, but now absent. │ │ This is a bug in the provider, which should be reported in the provider's │ own issue tracker. ╵
required_providers { azuread = "~> 2.0" azurerm = "~> 3.14.0" }

@magnooliveira12
Copy link

Facing the same issue.
Trying to create a linked service with cosmosdb.

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to azurerm_synapse_linked_service.cosmostflink,
│ provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced
│ an unexpected new value: Root resource was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

`terraform {
required_version = "~> 1.2.0"

required_providers {

azurerm = {
  source  = "hashicorp/azurerm"
  version = ">= 3.15.0, < 4.0.0"
}

azuread = {
  source  = "hashicorp/azuread"
  version = "~> 2.19.1"
}

null = {
  source  = "hashicorp/null"
  version = "3.1.0"
}

}
}`

@sujeetkp
Copy link

sujeetkp commented Aug 7, 2022

facing the same issue:

Error: Provider produced inconsistent result after apply │ │ When applying changes to azurerm_subnet_network_security_group_association.aks_subnet_nsg_associate, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root │ resource was present, but now absent. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker.

`# Terraform Block
terraform {
required_version = ">= 1.0.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 2.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.0"
}
null = {
source = "hashicorp/null"
version = ">= 3.0"
}
}

backend "azurerm" {}

}

provider "azurerm" {
features {}
}
`

@bhvkrishna90
Copy link

Same Issue with the below config for azurerm_synapse_linked_service

TERRAFORM_VERSION=1.1.4
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.19.1"
}
}

@volvocarsmatt
Copy link

volvocarsmatt commented Sep 1, 2022

We seem to have the same issue. We managed to set it up in Workspace UI, but not as Terraform

Terraform v1.2.7
azurerm v3.20.0

data "azurerm_key_vault_secret" "our_cosmos_conn" {
  name         = "our-cosmos-primary-conn"
  key_vault_id = data.azurerm_key_vault.key_vault.id

}

resource "azurerm_synapse_linked_service" "cosmos" {
  name                 = "our_cosmos_tf"
  synapse_workspace_id = azurerm_synapse_workspace.dni_workspace.id
  type                 = "Azure Cosmos DB (SQL API)"
  type_properties_json = <<JSON
{
  "connectionString": "${data.azurerm_key_vault_secret.our_cosmos_conn.value}Database=test-our-cosmos-sql"
}
JSON
}

The output

azurerm_synapse_linked_service.cosmos: Creating...
azurerm_synapse_linked_service.cosmos: Still creating... [10s elapsed]
azurerm_synapse_linked_service.cosmos: Still creating... [20s elapsed]
azurerm_synapse_linked_service.cosmos: Still creating... [30s elapsed]

│ Error: Provider produced inconsistent result after apply

│ When applying changes to azurerm_synapse_linked_service.cosmos, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new
│ value: Root resource was present, but now absent.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Releasing state lock. This may take a few moments...

The database is in another subscription, but since other got the same error, this is not the issue?

@Pravez
Copy link

Pravez commented Nov 28, 2022

Facing the same issue when trying to create a linked service with an Azure SQL Database ...

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to azurerm_synapse_linked_service.sql_link, provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root resource was present, but now
│ absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Terraform version : 1.3.4
AzureRM provider version : 3.33.0

@mbfrahry
Copy link
Member

Hey all. This was a weird one to track down but it turns out the type being passed into the linked service was wrong.

Azure Cosmos DB (SQL API) is just supposed to be CosmosDb. I've updated the validation for type and added all the possible values for it with #19636.

That'll go out in 3.36.0 of the provider! Hope that helps unblock everyone here

@github-actions
Copy link

This functionality has been released in v3.36.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.