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 missing columns and update Azure Go SDK to use Azure ARM package in the table azure_postgresql_flexible_server Closes #821 #824

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented Aug 20, 2024

Integration test logs

Logs

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_postgresql_flexible_server []

PRETEST: tests/azure_postgresql_flexible_server

TEST: tests/azure_postgresql_flexible_server
Running terraform
azurerm_resource_group.named_test_resource: Refreshing state... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422]
azurerm_virtual_network.named_test_resource: Refreshing state... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/virtualNetworks/turbottest19422]
azurerm_private_dns_zone.named_test_resource: Refreshing state... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/privateDnsZones/turbottest19422.postgres.database.azure.com]
azurerm_subnet.named_test_resource: Refreshing state... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/virtualNetworks/turbottest19422/subnets/turbottest19422]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Refreshing state... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/privateDnsZones/turbottest19422.postgres.database.azure.com/virtualNetworkLinks/turbottest19422.com]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # azurerm_postgresql_flexible_server.named_test_resource will be created
  + resource "azurerm_postgresql_flexible_server" "named_test_resource" {
      + administrator_login           = "psqladmin"
      + administrator_password        = (sensitive value)
      + backup_retention_days         = (known after apply)
      + delegated_subnet_id           = (known after apply)
      + fqdn                          = (known after apply)
      + geo_redundant_backup_enabled  = false
      + id                            = (known after apply)
      + location                      = "eastus"
      + name                          = "turbottest46821"
      + private_dns_zone_id           = (known after apply)
      + public_network_access_enabled = (known after apply)
      + resource_group_name           = "turbottest46821"
      + sku_name                      = "GP_Standard_D4s_v3"
      + storage_mb                    = 32768
      + tags                          = {
          + "name" = "turbottest46821"
        }
      + version                       = "12"
      + zone                          = "1"
    }

  # azurerm_private_dns_zone.named_test_resource must be replaced
-/+ resource "azurerm_private_dns_zone" "named_test_resource" {
      ~ id                                                    = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/privateDnsZones/turbottest19422.postgres.database.azure.com" -> (known after apply)
      ~ max_number_of_record_sets                             = 25000 -> (known after apply)
      ~ max_number_of_virtual_network_links                   = 1000 -> (known after apply)
      ~ max_number_of_virtual_network_links_with_registration = 100 -> (known after apply)
      ~ name                                                  = "turbottest19422.postgres.database.azure.com" -> "test.turbottest46821.postgres.database.azure.com" # forces replacement
      ~ number_of_record_sets                                 = 1 -> (known after apply)
      ~ resource_group_name                                   = "turbottest19422" -> "turbottest46821" # forces replacement
      - tags                                                  = {} -> null

      - soa_record {
          - email         = "azureprivatedns-host.microsoft.com" -> null
          - expire_time   = 2419200 -> null
          - fqdn          = "turbottest19422.postgres.database.azure.com." -> null
          - host_name     = "azureprivatedns.net" -> null
          - minimum_ttl   = 10 -> null
          - refresh_time  = 3600 -> null
          - retry_time    = 300 -> null
          - serial_number = 1 -> null
          - tags          = {} -> null
          - ttl           = 3600 -> null
        }
    }

  # azurerm_private_dns_zone_virtual_network_link.named_test_resource will be created
  + resource "azurerm_private_dns_zone_virtual_network_link" "named_test_resource" {
      + id                    = (known after apply)
      + name                  = "turbottest46821.com"
      + private_dns_zone_name = "test.turbottest46821.postgres.database.azure.com"
      + registration_enabled  = false
      + resource_group_name   = "turbottest46821"
      + virtual_network_id    = (known after apply)
    }

  # azurerm_resource_group.named_test_resource must be replaced
-/+ resource "azurerm_resource_group" "named_test_resource" {
      ~ id       = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422" -> (known after apply)
      ~ name     = "turbottest19422" -> "turbottest46821" # forces replacement
      - tags     = {} -> null
        # (1 unchanged attribute hidden)
    }

  # azurerm_subnet.named_test_resource must be replaced
-/+ resource "azurerm_subnet" "named_test_resource" {
      ~ id                                             = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/virtualNetworks/turbottest19422/subnets/turbottest19422" -> (known after apply)
      ~ name                                           = "turbottest19422" -> "turbottest46821" # forces replacement
      ~ resource_group_name                            = "turbottest19422" -> "turbottest46821" # forces replacement
      - service_endpoint_policy_ids                    = [] -> null
      ~ virtual_network_name                           = "turbottest19422" -> "turbottest46821" # forces replacement
        # (4 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # azurerm_virtual_network.named_test_resource must be replaced
-/+ resource "azurerm_virtual_network" "named_test_resource" {
      ~ dns_servers             = [] -> (known after apply)
      - flow_timeout_in_minutes = 0 -> null
      ~ guid                    = "202b0c6e-c929-4557-bbcb-c48565b8f6b2" -> (known after apply)
      ~ id                      = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/virtualNetworks/turbottest19422" -> (known after apply)
      ~ name                    = "turbottest19422" -> "turbottest46821" # forces replacement
      ~ resource_group_name     = "turbottest19422" -> "turbottest46821" # forces replacement
      ~ subnet                  = [
          - {
              - address_prefix = "10.0.2.0/24"
              - id             = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/virtualNetworks/turbottest19422/subnets/turbottest19422"
              - name           = "turbottest19422"
              - security_group = ""
            },
        ] -> (known after apply)
      - tags                    = {} -> null
        # (2 unchanged attributes hidden)
    }

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

Changes to Outputs:
  + resource_aka       = (known after apply)
  + resource_aka_lower = (known after apply)
  + resource_id        = (known after apply)
  + resource_name      = "turbottest46821"
  + subscription_id    = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
azurerm_subnet.named_test_resource: Destroying... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/virtualNetworks/turbottest19422/subnets/turbottest19422]
azurerm_private_dns_zone.named_test_resource: Destroying... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/privateDnsZones/turbottest19422.postgres.database.azure.com]
azurerm_private_dns_zone.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...ttest19422.postgres.database.azure.com, 10s elapsed]
azurerm_subnet.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...urbottest19422/subnets/turbottest19422, 10s elapsed]
azurerm_subnet.named_test_resource: Destruction complete after 11s
azurerm_virtual_network.named_test_resource: Destroying... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422/providers/Microsoft.Network/virtualNetworks/turbottest19422]
azurerm_private_dns_zone.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...ttest19422.postgres.database.azure.com, 20s elapsed]
azurerm_virtual_network.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...etwork/virtualNetworks/turbottest19422, 10s elapsed]
azurerm_virtual_network.named_test_resource: Destruction complete after 13s
azurerm_private_dns_zone.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...ttest19422.postgres.database.azure.com, 30s elapsed]
azurerm_private_dns_zone.named_test_resource: Destruction complete after 35s
azurerm_resource_group.named_test_resource: Destroying... [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest19422]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 10s elapsed]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 20s elapsed]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 30s elapsed]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 40s elapsed]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 50s elapsed]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 1m0s elapsed]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 1m10s elapsed]
azurerm_resource_group.named_test_resource: Still destroying... [id=/subscriptions/d46d7416-f95f-4771-bbb5-...c76659c/resourceGroups/turbottest19422, 1m20s elapsed]
azurerm_resource_group.named_test_resource: Destruction complete after 1m20s
azurerm_resource_group.named_test_resource: Creating...
azurerm_resource_group.named_test_resource: Creation complete after 3s [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821]
azurerm_private_dns_zone.named_test_resource: Creating...
azurerm_virtual_network.named_test_resource: Creating...
azurerm_virtual_network.named_test_resource: Creation complete after 8s [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.Network/virtualNetworks/turbottest46821]
azurerm_subnet.named_test_resource: Creating...
azurerm_private_dns_zone.named_test_resource: Still creating... [10s elapsed]
azurerm_subnet.named_test_resource: Creation complete after 6s [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.Network/virtualNetworks/turbottest46821/subnets/turbottest46821]
azurerm_private_dns_zone.named_test_resource: Still creating... [20s elapsed]
azurerm_private_dns_zone.named_test_resource: Still creating... [30s elapsed]
azurerm_private_dns_zone.named_test_resource: Creation complete after 35s [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.Network/privateDnsZones/test.turbottest46821.postgres.database.azure.com]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Creating...
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Still creating... [10s elapsed]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Still creating... [20s elapsed]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Still creating... [30s elapsed]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Still creating... [40s elapsed]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Still creating... [50s elapsed]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Still creating... [1m0s elapsed]
azurerm_private_dns_zone_virtual_network_link.named_test_resource: Creation complete after 1m6s [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.Network/privateDnsZones/test.turbottest46821.postgres.database.azure.com/virtualNetworkLinks/turbottest46821.com]
azurerm_postgresql_flexible_server.named_test_resource: Creating...
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [10s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [20s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [30s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [40s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [50s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [1m0s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [1m10s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [1m20s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [1m30s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [1m40s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [1m50s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [2m0s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [2m10s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [2m20s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [2m30s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [2m40s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [2m50s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [3m0s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [3m10s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [3m20s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [3m30s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [3m40s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [3m50s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [4m0s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [4m10s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [4m20s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [4m30s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [4m40s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [4m50s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Still creating... [5m0s elapsed]
azurerm_postgresql_flexible_server.named_test_resource: Creation complete after 5m8s [id=/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.DBforPostgreSQL/flexibleServers/turbottest46821]

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

Outputs:

resource_aka = "azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.DBforPostgreSQL/flexibleServers/turbottest46821"
resource_aka_lower = "azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/turbottest46821/providers/microsoft.dbforpostgresql/flexibleservers/turbottest46821"
resource_id = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.DBforPostgreSQL/flexibleServers/turbottest46821"
resource_name = "turbottest46821"
subscription_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Running SQL query: test-get-query.sql

Time: 3.1s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 1.

Scans:
  1) azure_postgresql_flexible_server.azure: Time: 2.8s. Fetched: 1. Hydrates: 1. Quals: name=turbottest46821, resource_group=turbottest46821.

[
  {
    "administrator_login": "psqladmin",
    "name": "turbottest46821",
    "resource_group": "turbottest46821",
    "subscription_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "version": "12"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql

Time: 11.5s. Rows returned: 1. Rows fetched: 3. Hydrate calls: 0.

Scans:
  1) azure_postgresql_flexible_server.azure: Time: 11.2s. Fetched: 3. Hydrates: 0. Quals: name=turbottest46821.

[
  {
    "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.DBforPostgreSQL/flexibleServers/turbottest46821",
    "name": "turbottest46821"
  }
]
✔ PASSED

Running SQL query: test-not-found-query.sql

Time: 1.8s. Rows returned: 0.
[]
✔ PASSED

Running SQL query: test-turbot-query.sql

Time: 2.4s. Rows returned: 1. Rows fetched: 1. Hydrate calls: 0.

Scans:
  1) azure_postgresql_flexible_server.azure: Time: 2.0s. Fetched: 1. Hydrates: 0. Quals: resource_group=turbottest46821, name=turbottest46821.

[
  {
    "akas": [
      "azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/turbottest46821/providers/Microsoft.DBforPostgreSQL/flexibleServers/turbottest46821",
      "azure:///subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/turbottest46821/providers/microsoft.dbforpostgresql/flexibleservers/turbottest46821"
    ],
    "name": "turbottest46821",
    "tags": {
      "name": "turbottest46821"
    },
    "title": "turbottest46821"
  }
]
✔ PASSED

POSTTEST: tests/azure_postgresql_flexible_server

TEARDOWN: tests/azure_postgresql_flexible_server

SUMMARY:

1/1 passed.

Example query results

Results
> select * from azure_postgresql_flexible_server
+--------+--------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+-------+-------------------+------------------>
| name   | id                                                                                                                                   | type                                      | state | availability_zone | administrator_log>
+--------+--------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+-------+-------------------+------------------>
| tes643 | /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/new-rg/providers/Microsoft.DBforPostgreSQL/flexibleServers/tes643 | Microsoft.DBforPostgreSQL/flexibleServers | Ready | 3                 | Partha           >
|        |                                                                                                                                      |                                           |       |                   |                  >
|        |                                                                                                                                      |                                           |       |                   |                  >
|        |                                                                                                                                      |                                           |       |                   |                  >
|        |                                                                                                                                      |                                           |       |                   |                  >


> select name, public_network_access from azure_postgresql_flexible_server
+--------+-----------------------+
| name   | public_network_access |
+--------+-----------------------+
| tes643 | Enabled               |
+--------+-----------------------+

> select name, public_network_access from azure_postgresql_flexible_server
+--------+-----------------------+
| name   | public_network_access |
+--------+-----------------------+
| tes643 | Disabled              |
+--------+-----------------------+

> select name, public_network_access from azure_postgresql_flexible_server where name = 'tes643' and resource_group = 'new-rg'
+--------+-----------------------+
| name   | public_network_access |
+--------+-----------------------+
| tes643 | Enabled               |
+--------+-----------------------+

…in the table azure_postgresql_flexible_server Closes #821
@ParthaI ParthaI requested a review from misraved August 20, 2024 12:05
@ParthaI ParthaI self-assigned this Aug 20, 2024
Transform: transform.FromField("Properties.AdministratorLogin"),
},
{
Name: "administrator_login_password",
Copy link
Contributor

Choose a reason for hiding this comment

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

@ParthaI I think we should not include this column since it includes sensitive data.

@misraved misraved merged commit 9d2de36 into main Sep 2, 2024
1 check passed
@misraved misraved deleted the issue-821 branch September 2, 2024 06:54
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.

azure_postgresql_flexible_server does not return public network access or similar flag
2 participants