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

azurerm_storage_queue URL is incorrect in state file when using a private endpoint #25383

Closed
1 task done
cochrasc opened this issue Mar 22, 2024 · 3 comments
Closed
1 task done

Comments

@cochrasc
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.6.2

AzureRM Provider Version

1.96.0

Affected Resource(s)/Data Source(s)

azurerm_storage_queue

Terraform Configuration Files

variable "client_id_privateDNS" {}
variable "client_secret_privateDNS" {}
variable "subscription_id_saPrivateDNS" {}

terraform {
  required_version = "=1.6.2"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=3.96.0"
    }
  }
}

provider "azurerm" {
  features {}
}

provider "azurerm" {
  alias                      = "sa_privateDNS"
  client_id                  = var.client_id_privateDNS
  client_secret              = var.client_secret_privateDNS
  subscription_id            = var.subscription_id_saPrivateDNS
  skip_provider_registration = true
  features {}
}

data "azurerm_subnet" "this" {
  name                 = "terraform-testing"
  virtual_network_name = "non-prod-vnet-iac-m-def7"
  resource_group_name  = "non-prod-iac-module-test-framework-vnet-rg"
}

# - 
# - Resource Group
# - 
resource "azurerm_resource_group" "this" {
  name     = "sdctest01-rg"
  location = "centralus"
}

# -
# - Storage Account
# -
resource "azurerm_storage_account" "this" {
  name                            = "sdctest01"
  resource_group_name             = azurerm_resource_group.this.name
  location                        = azurerm_resource_group.this.location
  account_tier                    = "Standard"
  account_replication_type        = "LRS"
  account_kind                    = "StorageV2"
  access_tier                     = "Hot"
  enable_https_traffic_only       = true
  public_network_access_enabled   = false
  allow_nested_items_to_be_public = false

  network_rules {
    bypass                     = ["AzureServices"]
    default_action             = "Deny"
    ip_rules                   = ["204.194.140.0/22", "136.226.2.209", "104.129.205.95"]
    virtual_network_subnet_ids = []
  }

  identity {
    type = "SystemAssigned"
  }
}

resource "azurerm_storage_queue" "this" {
  name                 = "sdctest01-queue"
  storage_account_name = azurerm_storage_account.this.name
  depends_on           = [azurerm_private_dns_a_record.queue]
}

# - 
# - Queue Private Endpoint
# - 
resource "azurerm_private_endpoint" "queue" {
  name                = "sdctest01-queue-pe"
  location            = azurerm_resource_group.this.location
  resource_group_name = azurerm_resource_group.this.name
  subnet_id           = data.azurerm_subnet.this.id

  private_service_connection {
    name                           = "sdctest01-queue-conn"
    private_connection_resource_id = azurerm_storage_account.this.id
    subresource_names              = ["queue"]
    is_manual_connection           = false
  }
}

# -
# - Queue "A" Records
# -
resource "azurerm_private_dns_a_record" "queue" {
  provider            = azurerm.sa_privateDNS
  name                = azurerm_storage_account.this.name
  zone_name           = "privatelink.queue.core.windows.net"
  resource_group_name = "prod-bluecat-dns-ofs-hybrid-shared-dns-rg"
  ttl                 = 300
  records             = [azurerm_private_endpoint.queue.custom_dns_configs[0].ip_addresses[0]]
}

Debug Output/Panic Output

https://gist.github.com/cochrasc/881b2d2209a8ec3c7444f83ebd792727

Expected Behaviour

Correct URL should be added to state so the queue can be updated/deleted/etc.
ID URL should be https://sdctest01.queue.core.windows.net/sdctest01-queue

Actual Behaviour

ID URL is written to state with table.core.windows.net instead of queue.core.windows.net

  "instances": [
    {
      "status": "tainted",
      "schema_version": 1,
      "attributes": {
        "id": "https://sdctest01.table.core.windows.net/sdctest01-queue",
        "metadata": null,
        "name": "sdctest01-queue",
        "resource_manager_id": null,
        "storage_account_name": "sdctest01",
        "timeouts": null
      },

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

@rcskosir
Copy link
Contributor

@cochrasc Thank's for taking the time to open this issue, I assume you mean version 3.96 of the provider, not 1.96? If so I believe this is a duplicate of #25261 which was solved via #25262 which has been released (v3.97.1 is latest as of me writing this comment). Please do reach out if this does not fix your issue and we can reopen this.

@cochrasc
Copy link
Author

cochrasc commented Mar 22, 2024

@rcskosir Thanks, and my apologies for the duplication. Apparently, I only looked in open issues when I searched to see if it was already reported.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants