hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.53k stars 4.6k forks source link

azurerm_synapse_linked_service - add PowerBIWorkspace for type #19920

Open alexarwady opened 1 year ago

alexarwady commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.7

AzureRM Provider Version

3.38.0

Affected Resource(s)/Data Source(s)

azurerm_synapse_linked_service

Terraform Configuration Files

terraform {
  required_version = "~>1.2.0"
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">=3.38.0"
    }
    random = {
      source = "hashicorp/random"
      version = ">= 3.4.3"
    }
  }
}

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_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" "powerbi" {
  name                 = "synw-powerbi"
  synapse_workspace_id = azurerm_synapse_workspace.synapse.id
  type                 = "PowerBIWorkspace"
  type_properties_json = <<JSON
{
  "workspaceID": "***",
  "tenantID": "***"
}
JSON

  depends_on = [
    azurerm_synapse_firewall_rule.synapse
  ]
}

Debug Output/Panic Output


Error: expected type to be one of [AmazonMWS AmazonRdsForOracle AmazonRdsForSqlServer AmazonRedshift AmazonS3 AzureBatch AzureBlobFS AzureBlobStorage AzureDataExplorer AzureDataLakeAnalytics AzureDataLakeStore AzureDatabricks AzureDatabricksDeltaLake AzureFileStorage AzureFunction AzureKeyVault AzureML AzureMLService AzureMariaDB AzureMySql AzurePostgreSql AzureSqlDW AzureSqlDatabase AzureSqlMI AzureSearch AzureStorage AzureTableStorage Cassandra CommonDataServiceForApps Concur CosmosDb CosmosDbMongoDbApi Couchbase CustomDataSource Db2 Drill Dynamics DynamicsAX DynamicsCrm Eloqua FileServer FtpServer GoogleAdWords GoogleBigQuery GoogleCloudStorage Greenplum HBase HDInsight HDInsightOnDemand HttpServer Hdfs Hive Hubspot Impala Informix Jira LinkedService Magento MariaDB Marketo MicrosoftAccess MongoDb MongoDbAtlas MongoDbV2 MySql Netezza OData Odbc Office365 Oracle OracleServiceCloud Paypal Phoenix PostgreSql Presto QuickBooks Responsys RestService SqlServer Salesforce SalesforceMarketingCloud SalesforceServiceCloud SapBW SapCloudForCustomer SapEcc SapHana SapOpenHub SapTable ServiceNow Sftp SharePointOnlineList Shopify Snowflake Spark Square Sybase Teradata Vertica Web Xero Zoho], got PowerBIWorkspace

Expected Behaviour

Created a PowerBI linked service in Azure Synapse without giving an error.

Actual Behaviour

Gave an error.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

According to: https://learn.microsoft.com/en-us/rest/api/synapse/data-plane/linked-service/create-or-update-linked-service?tabs=HTTP#powerbiworkspacelinkedservice, we should be able to create a PowerBI linked service in Azure Synapse with type string PowerBIWorkspace.

Maphenduka89 commented 1 year ago

Any progress on this?

ms-henglu commented 1 year ago

Hi @alexarwady ,

Thank you for taking time to report this issue.

The definition of the PowerBIWorkspace is missing in the api-version that azurerm currently uses. I've created an issue to track it: https://github.com/Azure/azure-rest-api-specs/issues/22796