有没有办法使用 terraform 或 arm 模板为突触配置 git?
Is there a way to configure git for synapse using terraform or arm templates?
'''
data "azurerm_client_config" "current" {}
resource "azurerm_synapse_workspace" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
storage_data_lake_gen2_filesystem_id = data.azurerm_storage_container.example
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "admin@123"
azure_devops_repo {
account_name = "organizationaz440"
branch_name = "Development"
project_name = "TestProject"
repository_name = "DataOps"
root_folder = "/SynapseNew"
tenant_id = data.azurerm_client_config.current.tenant_id
}
depends_on = [resource.azurerm_synapse_workspace.example]
}
'''
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/synapse_workspace
错误:此处不应包含“azure_devops_repo”类型的块。
尝试在 azurerm_synapse_workspace 中设置您的 azure_devops_repo,如下所示:
azure_devops_repo = [{
account_name = "organizationaz440"
branch_name = "Development"
project_name = "TestProject"
repository_name = "DataOps"
root_folder = "/SynapseNew"
tenant_id = data.azurerm_client_config.current.tenant_id
}]
基本上,作为对象列表。
有几件事需要解决:
- You are giving
storage_data_lake_gen2_filesystem_id = data.azurerm_storage_container.example
instead you have to give
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
. You have to
create a datalake gen 2 filesystem using your exisitng storage
account as data source for azurerm_storage_data_lake_gen2_filesystem
is not supported.
- You can remove this
tenant_id = data.azurerm_client_config.current.tenant_id
as its optional and
keeping it will give an error that An argument named "tenant_id" is not expected here.
- You can remove
depends_on = [resource.azurerm_synapse_workspace.example]
as its not required.
因此,在进行上述更改后,.tf 文件将如下所示:
provider "azurerm" {
features{}
}
data "azurerm_storage_account" "name" {
name = "ansumanstorageacc"
resource_group_name = "yourresourcegroupname"
}
resource "azurerm_storage_data_lake_gen2_filesystem" "example" {
name = "example"
storage_account_id = data.azurerm_storage_account.name.id
}
resource "azurerm_synapse_workspace" "example" {
name = "example"
resource_group_name = "yourresourcegroupname"
location = "West US 2"
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "admin@123"
azure_devops_repo {
account_name = "organizationaz440"
branch_name = "Development"
project_name = "TestProject"
repository_name = "DataOps"
root_folder = "/SynapseNew"
}
}
输出:
地形应用-自动批准:
'''
data "azurerm_client_config" "current" {}
resource "azurerm_synapse_workspace" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
storage_data_lake_gen2_filesystem_id = data.azurerm_storage_container.example
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "admin@123"
azure_devops_repo {
account_name = "organizationaz440"
branch_name = "Development"
project_name = "TestProject"
repository_name = "DataOps"
root_folder = "/SynapseNew"
tenant_id = data.azurerm_client_config.current.tenant_id
}
depends_on = [resource.azurerm_synapse_workspace.example]
}
'''
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/synapse_workspace
错误:此处不应包含“azure_devops_repo”类型的块。
尝试在 azurerm_synapse_workspace 中设置您的 azure_devops_repo,如下所示:
azure_devops_repo = [{
account_name = "organizationaz440"
branch_name = "Development"
project_name = "TestProject"
repository_name = "DataOps"
root_folder = "/SynapseNew"
tenant_id = data.azurerm_client_config.current.tenant_id
}]
基本上,作为对象列表。
有几件事需要解决:
- You are giving
storage_data_lake_gen2_filesystem_id = data.azurerm_storage_container.example
instead you have to givestorage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
. You have to create a datalake gen 2 filesystem using your exisitng storage account as data source forazurerm_storage_data_lake_gen2_filesystem
is not supported.- You can remove this
tenant_id = data.azurerm_client_config.current.tenant_id
as its optional and keeping it will give an error thatAn argument named "tenant_id" is not expected here.
- You can remove
depends_on = [resource.azurerm_synapse_workspace.example]
as its not required.
因此,在进行上述更改后,.tf 文件将如下所示:
provider "azurerm" {
features{}
}
data "azurerm_storage_account" "name" {
name = "ansumanstorageacc"
resource_group_name = "yourresourcegroupname"
}
resource "azurerm_storage_data_lake_gen2_filesystem" "example" {
name = "example"
storage_account_id = data.azurerm_storage_account.name.id
}
resource "azurerm_synapse_workspace" "example" {
name = "example"
resource_group_name = "yourresourcegroupname"
location = "West US 2"
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "admin@123"
azure_devops_repo {
account_name = "organizationaz440"
branch_name = "Development"
project_name = "TestProject"
repository_name = "DataOps"
root_folder = "/SynapseNew"
}
}
输出:
地形应用-自动批准: