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

Conversation

c0d3r-arnab
Copy link
Contributor

Integration test logs

Logs
arnab@turbotindias-MacBook-Pro azure-test % ./tint.js azure_synapse_workspace
No env file present for the current environment:  staging 
 Falling back to .env config
No env file present for the current environment:  staging
customEnv TURBOT_TEST_EXPECTED_TIMEOUT undefined

SETUP: tests/azure_synapse_workspace []

PRETEST: tests/azure_synapse_workspace

TEST: tests/azure_synapse_workspace
Running terraform

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_resource_group.named_test_resource will be created
  + resource "azurerm_resource_group" "named_test_resource" {
      + id       = (known after apply)
      + location = "westeurope"
      + name     = "turbottest78394"
    }

  # azurerm_storage_account.named_test_resource will be created
  + resource "azurerm_storage_account" "named_test_resource" {
      + access_tier                      = (known after apply)
      + account_kind                     = "StorageV2"
      + account_replication_type         = "LRS"
      + account_tier                     = "Standard"
      + allow_blob_public_access         = false
      + enable_https_traffic_only        = true
      + id                               = (known after apply)
      + is_hns_enabled                   = true
      + large_file_share_enabled         = (known after apply)
      + location                         = "westeurope"
      + min_tls_version                  = "TLS1_0"
      + name                             = "turbottest78394"
      + nfsv3_enabled                    = false
      + primary_access_key               = (sensitive value)
      + primary_blob_connection_string   = (sensitive value)
      + primary_blob_endpoint            = (known after apply)
      + primary_blob_host                = (known after apply)
      + primary_connection_string        = (sensitive value)
      + primary_dfs_endpoint             = (known after apply)
      + primary_dfs_host                 = (known after apply)
      + primary_file_endpoint            = (known after apply)
      + primary_file_host                = (known after apply)
      + primary_location                 = (known after apply)
      + primary_queue_endpoint           = (known after apply)
      + primary_queue_host               = (known after apply)
      + primary_table_endpoint           = (known after apply)
      + primary_table_host               = (known after apply)
      + primary_web_endpoint             = (known after apply)
      + primary_web_host                 = (known after apply)
      + resource_group_name              = "turbottest78394"
      + secondary_access_key             = (sensitive value)
      + secondary_blob_connection_string = (sensitive value)
      + secondary_blob_endpoint          = (known after apply)
      + secondary_blob_host              = (known after apply)
      + secondary_connection_string      = (sensitive value)
      + secondary_dfs_endpoint           = (known after apply)
      + secondary_dfs_host               = (known after apply)
      + secondary_file_endpoint          = (known after apply)
      + secondary_file_host              = (known after apply)
      + secondary_location               = (known after apply)
      + secondary_queue_endpoint         = (known after apply)
      + secondary_queue_host             = (known after apply)
      + secondary_table_endpoint         = (known after apply)
      + secondary_table_host             = (known after apply)
      + secondary_web_endpoint           = (known after apply)
      + secondary_web_host               = (known after apply)
      + shared_access_key_enabled        = true

      + blob_properties {
          + change_feed_enabled      = (known after apply)
          + default_service_version  = (known after apply)
          + last_access_time_enabled = (known after apply)
          + versioning_enabled       = (known after apply)

          + container_delete_retention_policy {
              + days = (known after apply)
            }

          + cors_rule {
              + allowed_headers    = (known after apply)
              + allowed_methods    = (known after apply)
              + allowed_origins    = (known after apply)
              + exposed_headers    = (known after apply)
              + max_age_in_seconds = (known after apply)
            }

          + delete_retention_policy {
              + days = (known after apply)
            }
        }

      + identity {
          + identity_ids = (known after apply)
          + principal_id = (known after apply)
          + tenant_id    = (known after apply)
          + type         = (known after apply)
        }

      + network_rules {
          + bypass                     = (known after apply)
          + default_action             = (known after apply)
          + ip_rules                   = (known after apply)
          + virtual_network_subnet_ids = (known after apply)

          + private_link_access {
              + endpoint_resource_id = (known after apply)
              + endpoint_tenant_id   = (known after apply)
            }
        }

      + queue_properties {
          + cors_rule {
              + allowed_headers    = (known after apply)
              + allowed_methods    = (known after apply)
              + allowed_origins    = (known after apply)
              + exposed_headers    = (known after apply)
              + max_age_in_seconds = (known after apply)
            }

          + hour_metrics {
              + enabled               = (known after apply)
              + include_apis          = (known after apply)
              + retention_policy_days = (known after apply)
              + version               = (known after apply)
            }

          + logging {
              + delete                = (known after apply)
              + read                  = (known after apply)
              + retention_policy_days = (known after apply)
              + version               = (known after apply)
              + write                 = (known after apply)
            }

          + minute_metrics {
              + enabled               = (known after apply)
              + include_apis          = (known after apply)
              + retention_policy_days = (known after apply)
              + version               = (known after apply)
            }
        }

      + routing {
          + choice                      = (known after apply)
          + publish_internet_endpoints  = (known after apply)
          + publish_microsoft_endpoints = (known after apply)
        }

      + share_properties {
          + cors_rule {
              + allowed_headers    = (known after apply)
              + allowed_methods    = (known after apply)
              + allowed_origins    = (known after apply)
              + exposed_headers    = (known after apply)
              + max_age_in_seconds = (known after apply)
            }

          + retention_policy {
              + days = (known after apply)
            }

          + smb {
              + authentication_types            = (known after apply)
              + channel_encryption_type         = (known after apply)
              + kerberos_ticket_encryption_type = (known after apply)
              + versions                        = (known after apply)
            }
        }
    }

  # azurerm_storage_data_lake_gen2_filesystem.named_test_resource will be created
  + resource "azurerm_storage_data_lake_gen2_filesystem" "named_test_resource" {
      + id                 = (known after apply)
      + name               = "turbottest78394"
      + storage_account_id = (known after apply)

      + ace {
          + id          = (known after apply)
          + permissions = (known after apply)
          + scope       = (known after apply)
          + type        = (known after apply)
        }
    }

  # azurerm_synapse_workspace.named_test_resource will be created
  + resource "azurerm_synapse_workspace" "named_test_resource" {
      + aad_admin                            = (known after apply)
      + connectivity_endpoints               = (known after apply)
      + id                                   = (known after apply)
      + identity                             = (known after apply)
      + location                             = "westeurope"
      + managed_resource_group_name          = (known after apply)
      + name                                 = "turbottest78394"
      + resource_group_name                  = "turbottest78394"
      + sql_administrator_login              = "sqladminuser"
      + sql_administrator_login_password     = (sensitive value)
      + storage_data_lake_gen2_filesystem_id = (known after apply)
      + tags                                 = {
          + "Name" = "turbottest78394"
        }
    }

Plan: 4 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + region                  = "westeurope"
  + resource_aka            = (known after apply)
  + resource_aka_lower      = (known after apply)
  + resource_id             = (known after apply)
  + resource_name           = "turbottest78394"
  + sql_administrator_login = "sqladminuser"
  + subscription_id         = "d46d7416-f95f-4771-bbb5-529d4c76659c"
azurerm_resource_group.named_test_resource: Creating...
azurerm_resource_group.named_test_resource: Creation complete after 2s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394]
azurerm_storage_account.named_test_resource: Creating...
azurerm_storage_account.named_test_resource: Still creating... [10s elapsed]
azurerm_storage_account.named_test_resource: Still creating... [20s elapsed]
azurerm_storage_account.named_test_resource: Still creating... [30s elapsed]
azurerm_storage_account.named_test_resource: Creation complete after 32s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394/providers/Microsoft.Storage/storageAccounts/turbottest78394]
azurerm_storage_data_lake_gen2_filesystem.named_test_resource: Creating...
azurerm_storage_data_lake_gen2_filesystem.named_test_resource: Creation complete after 5s [id=https://turbottest78394.dfs.core.windows.net/turbottest78394]
azurerm_synapse_workspace.named_test_resource: Creating...
azurerm_synapse_workspace.named_test_resource: Still creating... [10s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [20s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [30s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [40s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [50s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [1m0s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [1m10s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [1m20s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [1m30s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [1m40s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [1m50s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [2m0s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [2m10s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [2m20s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [2m30s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [2m40s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [2m50s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [3m0s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [3m10s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [3m20s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [3m30s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [3m40s elapsed]
azurerm_synapse_workspace.named_test_resource: Still creating... [3m50s elapsed]
azurerm_synapse_workspace.named_test_resource: Creation complete after 3m53s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394/providers/Microsoft.Synapse/workspaces/turbottest78394]

Apply complete! Resources: 4 added, 0 changed, 0 destroyed.

Outputs:

region = "westeurope"
resource_aka = "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394/providers/Microsoft.Synapse/workspaces/turbottest78394"
resource_aka_lower = "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourcegroups/turbottest78394/providers/microsoft.synapse/workspaces/turbottest78394"
resource_id = "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394/providers/Microsoft.Synapse/workspaces/turbottest78394"
resource_name = "turbottest78394"
sql_administrator_login = "sqladminuser"
subscription_id = "d46d7416-f95f-4771-bbb5-529d4c76659c"

Running SQL query: test-get-query.sql
[
  {
    "id": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394/providers/Microsoft.Synapse/workspaces/turbottest78394",
    "name": "turbottest78394",
    "region": "westeurope",
    "resource_group": "turbottest78394",
    "sql_administrator_login": "sqladminuser",
    "subscription_id": "d46d7416-f95f-4771-bbb5-529d4c76659c",
    "tags": {
      "Name": "turbottest78394"
    },
    "type": "Microsoft.Synapse/workspaces"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394/providers/Microsoft.Synapse/workspaces/turbottest78394",
    "name": "turbottest78394",
    "region": "westeurope",
    "resource_group": "turbottest78394",
    "sql_administrator_login": "sqladminuser",
    "subscription_id": "d46d7416-f95f-4771-bbb5-529d4c76659c",
    "tags": {
      "Name": "turbottest78394"
    },
    "type": "Microsoft.Synapse/workspaces"
  }
]
✔ PASSED

Running SQL query: test-not-found-query.sql
null
✔ PASSED

Running SQL query: test-turbot-query.sql
[
  {
    "akas": [
      "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest78394/providers/Microsoft.Synapse/workspaces/turbottest78394",
      "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourcegroups/turbottest78394/providers/microsoft.synapse/workspaces/turbottest78394"
    ],
    "name": "turbottest78394",
    "tags": {
      "Name": "turbottest78394"
    },
    "title": "turbottest78394"
  }
]
✔ PASSED

POSTTEST: tests/azure_synapse_workspace

TEARDOWN: tests/azure_synapse_workspace

SUMMARY:

1/1 passed.

Example query results

Results
> select
  id,
  name,
  type,
  provisioning_state
from
  azure_synapse_workspace;
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+------------------------------+
| id                                                                                                                                                    | name              | type                         |
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+------------------------------+
| /subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/arnab-test-resource-group/providers/Microsoft.Synapse/workspaces/test-wrokspace-13 | test-wrokspace-13 | Microsoft.Synapse/workspaces |
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+------------------------------+
> select
  id,
  name,
  type,
  provisioning_state,
  public_network_access
from
  azure_synapse_workspace
where
  public_network_access = 'Enabled';
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+------------------------------+
| id                                                                                                                                                    | name              | type                         |
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+------------------------------+
| /subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/arnab-test-resource-group/providers/Microsoft.Synapse/workspaces/test-wrokspace-13 | test-wrokspace-13 | Microsoft.Synapse/workspaces |
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+------------------------------+
> select
  id,
  name,
  identity -> 'type' as identity_type
from
  azure_synapse_workspace
where
    exists (
      select
      from
        unnest(regexp_split_to_array(identity ->> 'type', ',')) elem
      where
        trim(elem) = 'UserAssigned'
  );
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+-------------------------------
| id                                                                                                                                                    | name              | identity_type                 
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+-------------------------------
| /subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/arnab-test-resource-group/providers/Microsoft.Synapse/workspaces/test-wrokspace-13 | test-wrokspace-13 | "SystemAssigned,UserAssigned" 
+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------+-------------------------------
> select
  name as workspace_name,
  id as workspace_id,
  connections ->> 'id' as connection_id,
  connections ->> 'privateEndpointPropertyId' as connection_private_endpoint_property_id,
  connections ->> 'privateLinkServiceConnectionStateActionsRequired' as connection_actions_required,
  connections ->> 'privateLinkServiceConnectionStateDescription' as connection_description,
  connections ->> 'privateLinkServiceConnectionStateStatus' as connection_status,
  connections ->> 'provisioningState' as connection_provisioning_state
from
  azure_synapse_workspace,
  jsonb_array_elements(private_endpoint_connections) as connections;
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------
| workspace_name    | workspace_id                                                                                                                                          | connection_id                 
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------
| test-wrokspace-13 | /subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/arnab-test-resource-group/providers/Microsoft.Synapse/workspaces/test-wrokspace-13 | /subscriptions/d46d7416-f95f-4
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------
> select
  name as workspace_name,
  id as workspace_id,
  encryption -> 'CmkKey' ->> 'keyVaultUrl' as cmk_key_vault_url,
  encryption -> 'CmkKey' ->> 'name' as cmk_key_name,
  encryption ->> 'CmkStatus' as cmk_status,
  encryption -> 'DoubleEncryptionEnabled' as double_encryption_enabled
from
  azure_synapse_workspace;
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------
| workspace_name    | workspace_id                                                                                                                                          | cmk_key_vault_url             
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------
| test-wrokspace-13 | /subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/arnab-test-resource-group/providers/Microsoft.Synapse/workspaces/test-wrokspace-13 | https://testing-synapse.vault.
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------
> 

@c0d3r-arnab c0d3r-arnab self-assigned this Sep 27, 2021
@c0d3r-arnab c0d3r-arnab linked an issue Sep 27, 2021 that may be closed by this pull request
Copy link
Contributor

@ParthaI ParthaI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@bigdatasourav bigdatasourav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bigdatasourav bigdatasourav merged commit a3e11fc into main Sep 28, 2021
@bigdatasourav bigdatasourav deleted the issue-302 branch September 28, 2021 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table azure_synapse_workspace
3 participants