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

Add table azure_synapse_workspace. Closes #302 #346

Merged
merged 3 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
14 changes: 14 additions & 0 deletions azure-test/tests/azure_synapse_workspace/test-get-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"region": "{{ output.region.value }}",
"resource_group": "{{ resourceName }}",
"sql_administrator_login": "{{ output.sql_administrator_login.value }}",
"subscription_id": "{{ output.subscription_id.value }}",
"tags": {
"Name": "{{ resourceName }}"
},
"type": "Microsoft.Synapse/workspaces"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_synapse_workspace/test-get-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, type, region, resource_group, subscription_id, tags, sql_administrator_login
from azure.azure_synapse_workspace
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
14 changes: 14 additions & 0 deletions azure-test/tests/azure_synapse_workspace/test-list-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"region": "{{ output.region.value }}",
"resource_group": "{{ resourceName }}",
"sql_administrator_login": "{{ output.sql_administrator_login.value }}",
"subscription_id": "{{ output.subscription_id.value }}",
"tags": {
"Name": "{{ resourceName }}"
},
"type": "Microsoft.Synapse/workspaces"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_synapse_workspace/test-list-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, type, region, resource_group, subscription_id, tags, sql_administrator_login
from azure.azure_synapse_workspace
where id = '{{ output.resource_id.value }}';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, type, region
from azure.azure_synapse_workspace
where name = 'dummy-test{{ resourceName }}' and resource_group = '{{ resourceName }}';
13 changes: 13 additions & 0 deletions azure-test/tests/azure_synapse_workspace/test-turbot-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"akas": [
"{{ output.resource_aka.value }}",
"{{ output.resource_aka_lower.value }}"
],
"name": "{{ resourceName }}",
"tags": {
"Name": "{{ resourceName }}"
},
"title": "{{ resourceName }}"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, akas, title, tags
from azure.azure_synapse_workspace
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
1 change: 1 addition & 0 deletions azure-test/tests/azure_synapse_workspace/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
95 changes: 95 additions & 0 deletions azure-test/tests/azure_synapse_workspace/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
variable "resource_name" {
type = string
default = "turbot-test-20200927-create-update"
description = "Name of the resource used throughout the test."
}

variable "azure_environment" {
type = string
default = "public"
description = "Azure environment used for the test."
}

variable "azure_subscription" {
type = string
default = "3510ae4d-530b-497d-8f30-53b9616fc6c1"
description = "Azure environment used for the test."
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.78.0"
}
}
}

provider "azurerm" {
# Cannot be passed as a variable
features {}
environment = var.azure_environment
subscription_id = var.azure_subscription
}

resource "azurerm_resource_group" "named_test_resource" {
name = var.resource_name
location = "West Europe"
}

resource "azurerm_storage_account" "named_test_resource" {
name = var.resource_name
resource_group_name = azurerm_resource_group.named_test_resource.name
location = azurerm_resource_group.named_test_resource.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
is_hns_enabled = "true"
}

resource "azurerm_storage_data_lake_gen2_filesystem" "named_test_resource" {
name = var.resource_name
storage_account_id = azurerm_storage_account.named_test_resource.id
}

resource "azurerm_synapse_workspace" "named_test_resource" {
name = var.resource_name
resource_group_name = azurerm_resource_group.named_test_resource.name
location = azurerm_resource_group.named_test_resource.location
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.named_test_resource.id
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "H@Sh1CoR3!"

tags = {
Name = var.resource_name
}
}

output "region" {
value = azurerm_resource_group.named_test_resource.location
}

output "resource_aka" {
depends_on = [azurerm_synapse_workspace.named_test_resource]
value = "azure://${azurerm_synapse_workspace.named_test_resource.id}"
}

output "resource_aka_lower" {
value = "azure://${lower(azurerm_synapse_workspace.named_test_resource.id)}"
}

output "resource_name" {
value = var.resource_name
}

output "resource_id" {
value = azurerm_synapse_workspace.named_test_resource.id
}

output "subscription_id" {
value = var.azure_subscription
}

output "sql_administrator_login" {
value = azurerm_synapse_workspace.named_test_resource.sql_administrator_login
}
1 change: 1 addition & 0 deletions azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"azure_stream_analytics_job": tableAzureStreamAnalyticsJob(ctx),
"azure_subnet": tableAzureSubnet(ctx),
"azure_subscription": tableAzureSubscription(ctx),
"azure_synapse_workspace": tableAzureSynapseWorkspace(ctx),
"azure_tenant": tableAzureTenant(ctx),
"azure_virtual_network": tableAzureVirtualNetwork(ctx),
"azure_virtual_network_gateway": tableAzureVirtualNetworkGateway(ctx),
Expand Down
Loading