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

Added column diagnostic_settings to azure_storage_account table. #432

Merged
merged 3 commits into from
Jan 5, 2022

Conversation

bigdatasourav
Copy link
Contributor

@bigdatasourav bigdatasourav commented Dec 30, 2021

Integration test logs

Logs
SETUP: tests/azure_storage_account []

PRETEST: tests/azure_storage_account

TEST: tests/azure_storage_account
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 = "eastus"
      + name     = "turbottest33803"
      + tags     = (known after apply)
    }

  # azurerm_storage_account.named_test_resource will be created
  + resource "azurerm_storage_account" "named_test_resource" {
      + access_tier                       = "Cool"
      + account_encryption_source         = "Microsoft.Storage"
      + account_kind                      = "StorageV2"
      + account_replication_type          = "LRS"
      + account_tier                      = "Standard"
      + account_type                      = (known after apply)
      + enable_advanced_threat_protection = false
      + enable_blob_encryption            = true
      + enable_file_encryption            = true
      + id                                = (known after apply)
      + is_hns_enabled                    = false
      + location                          = "eastus"
      + name                              = "turbottest33803"
      + 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               = "turbottest33803"
      + 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)
      + tags                              = {
          + "name" = "turbottest33803"
        }

      + identity {
          + 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)
        }

      + 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)
            }
        }
    }

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

Changes to Outputs:
  + resource_aka       = (known after apply)
  + resource_aka_lower = (known after apply)
  + resource_id        = (known after apply)
  + resource_name      = "turbottest33803"
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/turbottest33803]
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 30s [id=/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest33803/providers/Microsoft.Storage/storageAccounts/turbottest33803]

Warning: Version constraints inside provider configuration blocks are deprecated

  on variables.tf line 22, in provider "azurerm":
  22:   version         = "=1.36.0"

Terraform 0.13 and earlier allowed provider version constraints inside the
provider configuration block, but that is now deprecated and will be removed
in a future version of Terraform. To silence this warning, move the provider
version constraint into the required_providers block.

Warning: Deprecated Resource

  with data.null_data_source.resource,
  on variables.tf line 29, in data "null_data_source" "resource":
  29: data "null_data_source" "resource" {

The null_data_source was historically used to construct intermediate values
to re-use elsewhere in configuration, the same can now be achieved using
locals

(and one more similar warning elsewhere)

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

Outputs:

resource_aka = "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest33803/providers/Microsoft.Storage/storageAccounts/turbottest33803"
resource_aka_lower = "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourcegroups/turbottest33803/providers/microsoft.storage/storageaccounts/turbottest33803"
resource_id = "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest33803/providers/Microsoft.Storage/storageAccounts/turbottest33803"
resource_name = "turbottest33803"

Running SQL query: test-get-query.sql
[
  {
    "access_tier": "Cool",
    "id": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest33803/providers/Microsoft.Storage/storageAccounts/turbottest33803",
    "kind": "StorageV2",
    "name": "turbottest33803",
    "sku_name": "Standard_LRS",
    "sku_tier": "Standard"
  }
]
✔ PASSED

Running SQL query: test-hydrate-query.sql
[
  {
    "access_tier": "Cool",
    "id": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest33803/providers/Microsoft.Storage/storageAccounts/turbottest33803",
    "name": "turbottest33803"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql
[
  {
    "id": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourceGroups/turbottest33803/providers/Microsoft.Storage/storageAccounts/turbottest33803",
    "name": "turbottest33803"
  }
]
✔ 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/turbottest33803/providers/Microsoft.Storage/storageAccounts/turbottest33803",
      "azure:///subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourcegroups/turbottest33803/providers/microsoft.storage/storageaccounts/turbottest33803"
    ],
    "tags": {
      "name": "turbottest33803"
    },
    "title": "turbottest33803"
  }
]
✔ PASSED

POSTTEST: tests/azure_storage_account

TEARDOWN: tests/azure_storage_account

SUMMARY:

1/1 passed.

Example query results

Results
> select
  name,
  jsonb_pretty(diagnostic_settings) as diagnostic_settings
from
  azure_storage_account;
+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| name                   | diagnostic_settings                                                                                                                                                              
+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| csg10032000527a882b    | <null>                                                                                                                                                                           
| testimmutablecontainer | <null>                                                                                                                                                                           
| testt1                 | [                                                                                                                                                                                
|                        |     {                                                                                                                                                                            
|                        |         "ID": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourcegroups/turbot_rg/providers/microsoft.storage/storageaccounts/testt1/providers/microsoft.insights/diagn
|                        |         "Name": "ewre",                                                                                                                                                          
|                        |         "Type": "Microsoft.Insights/diagnosticSettings",                                                                                                                         
|                        |         "DiagnosticSettings": {                                                                                                                                                  
|                        |             "logs": [                                                                                                                                                            
|                        |             ],                                                                                                                                                                   
|                        |             "metrics": [                                                                                                                                                         
|                        |                 {                                                                                                                                                                
|                        |                     "enabled": true,                                                                                                                                             
|                        |                     "category": "Transaction",                                                                                                                                   
|                        |                     "retentionPolicy": {                                                                                                                                         
|                        |                         "days": 0,                                                                                                                                               
|                        |                         "enabled": false                                                                                                                                         
|                        |                     }                                                                                                                                                            
|                        |                 },                                                                                                                                                               
|                        |                 {                                                                                                                                                                
|                        |                     "enabled": false,                                                                                                                                            
|                        |                     "category": "Capacity",                                                                                                                                      
|                        |                     "retentionPolicy": {                                                                                                                                         
|                        |                         "days": 0,                                                                                                                                               
|                        |                         "enabled": false                                                                                                                                         
|                        |                     }                                                                                                                                                            
|                        |                 }                                                                                                                                                                
|                        |             ],                                                                                                                                                                   
|                        |             "storageAccountId": "/subscriptions/d46d7416-f95f-4771-bbb5-529d4c76659c/resourcegroups/turbot_rg/providers/microsoft.storage/storageaccounts/werewr"                
|                        |         }                                                                                                                                                                        
|                        |     }                                                                                                                                                                            
|                        | ]                                                                                                                                                                                
+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Copy link
Contributor

@rajlearner17 rajlearner17 left a comment

Choose a reason for hiding this comment

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

@bigdatasourav let's add one more example to extract some information from this column as example.

bigdatasourav added 2 commits January 4, 2022 20:03
Copy link
Contributor

@rajlearner17 rajlearner17 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 3263b6e into main Jan 5, 2022
@bigdatasourav bigdatasourav deleted the issue-428 branch January 5, 2022 07:39
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.

Create [table,file]_logging_* columns to azure_storage_account table
2 participants