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

EventGrid Topic Queue Event Subscription Creation fails "Error: ID contained more segments than required:" #6991

Closed
ghost opened this issue May 18, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented May 18, 2020

This issue was originally opened by @mluker as hashicorp/terraform#24979. It was migrated here as a result of the provider split. The original body of the issue is below.


When creating an event subscription with a storage queue as an endpoint within an event grid topic the resources are created as expected but an error is thrown and the event subscription in the state file becomes tainted and you can no longer run a plan or apply.

Terraform Version

Terraform v0.12.24
+ provider.azuread v0.9.0
+ provider.azurerm v2.10.0
+ provider.random v2.2.1

Terraform Code

resource "azurerm_resource_group" "default" {
  name     = "tf-testing"
  location = "West US 2"
}

resource "azurerm_eventgrid_topic" "default" {
  location            = "West US 2"
  name                = "default-topic"
  resource_group_name = azurerm_resource_group.default.name
}

resource "azurerm_storage_account" "default" {
  name                     = "defaultstoragefoo"
  resource_group_name      = azurerm_resource_group.default.name
  location                 = azurerm_resource_group.default.location
  account_tier             = "Standard"
  account_replication_type = "LRS"

}

resource "azurerm_storage_queue" "default" {
  name                 = "defaultstoragequeue"
  storage_account_name = azurerm_storage_account.default.name
}

resource "azurerm_eventgrid_event_subscription" "default" {
  name  = "defaultEventSubscription"
  scope = azurerm_eventgrid_topic.default.id

  storage_queue_endpoint {
    storage_account_id = azurerm_storage_account.default.id
    queue_name         = azurerm_storage_queue.default.name
  }
}

Terraform Output

module.event-topics.azurerm_storage_account.default: Creating...
module.event-topics.azurerm_storage_account.default: Still creating... [10s elapsed]
module.event-topics.azurerm_storage_account.default: Still creating... [20s elapsed]
module.event-topics.azurerm_storage_account.default: Creation complete after 25s [id=/subscriptions/***/resourceGroups/tf-testing/providers/Microsoft.Storage/storageAccounts/defaultstoragefoo]
module.event-topics.azurerm_storage_queue.default: Creating...
module.event-topics.azurerm_storage_queue.default: Creation complete after 1s [id=https://defaultstoragefoo.queue.core.windows.net/defaultstoragequeue]
module.event-topics.azurerm_eventgrid_event_subscription.default: Creating...
module.event-topics.azurerm_eventgrid_event_subscription.default: Still creating... [10s elapsed]
module.event-topics.azurerm_eventgrid_event_subscription.default: Still creating... [20s elapsed]
module.event-topics.azurerm_eventgrid_event_subscription.default: Still creating... [30s elapsed]
module.event-topics.azurerm_eventgrid_event_subscription.default: Still creating... [40s elapsed]
module.event-topics.azurerm_eventgrid_event_subscription.default: Still creating... [50s elapsed]
module.event-topics.azurerm_eventgrid_event_subscription.default: Still creating... [1m0s elapsed]

Error: ID contained more segments than required: "/subscriptions/***/resourceGroups/tf-testing/providers/Microsoft.EventGrid/topics/default-topic/providers/Microsoft.EventGrid/eventSubscriptions/defaultEventSubscription"

  on ../../modules/project/event-topics/main.tf line 159, in resource "azurerm_eventgrid_event_subscription" "default":
 159: resource "azurerm_eventgrid_event_subscription" "default" {

Expected Behavior

resources are created with no errors and the state is not tainted and a subsequent plan can be run.

Actual Behavior

When creating an event subscription with a storage queue as an endpoint within an event grid topic the resources are created as expected but an error is thrown and the event subscription in the state file becomes tainted and you can no longer run a plan or apply.

Steps to Reproduce

  1. terraform init
  2. terraform apply

ADDITIONAL INFO (TAINTED STATE)

{
      "module": "module.event-topics",
      "mode": "managed",
      "type": "azurerm_eventgrid_event_subscription",
      "name": "default",
      "provider": "provider.azurerm",
      "instances": [
        {
          "status": "tainted",
          "schema_version": 0,
          "attributes": {
            "event_delivery_schema": "EventGridSchema",
            "eventhub_endpoint": [],
            "hybrid_connection_endpoint": [],
            "id": "/subscriptions/***/resourceGroups/tf-testing/providers/Microsoft.EventGrid/topics/default-topic/providers/Microsoft.EventGrid/eventSubscriptions/defaultEventSubscription",
            "included_event_types": null,
            "labels": null,
            "name": "defaultEventSubscription",
            "retry_policy": null,
            "scope": "/subscriptions/***/resourceGroups/tf-testing/providers/Microsoft.EventGrid/topics/default-topic",
            "storage_blob_dead_letter_destination": [],
            "storage_queue_endpoint": [
              {
                "queue_name": "defaultstoragequeue",
                "storage_account_id": "/subscriptions/***/resourceGroups/tf-testing/providers/Microsoft.Storage/storageAccounts/defaultstoragefoo"
              }
            ],
            "subject_filter": [],
            "timeouts": null,
            "topic_name": null,
            "webhook_endpoint": []
          },
          "private": "***",
          "dependencies": [
            "module.event-topics.azurerm_eventgrid_topic.default",
            "module.event-topics.azurerm_resource_group.default",
            "module.event-topics.azurerm_storage_account.default",
            "module.event-topics.azurerm_storage_queue.default"
          ]
        }
      ]
    }
@jrauschenbusch
Copy link
Contributor

Duplicate of #6962

@tombuildsstuff
Copy link
Member

Closing as a duplicate of #6962 - thanks @jrauschenbusch

@ghost
Copy link
Author

ghost commented Jun 18, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jun 18, 2020
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