为什么Terraform想要重新创建资源,如果“替换”出现变化?

发布于 2025-02-03 05:24:43 字数 17620 浏览 3 评论 0原文

我有一个无法删除的Azure上的IoT中心。但是,从昨天开始,如果不重新创建整个IoT中心,我无法更新端点。但是,Terraform并没有告诉我为什么需要重新创建它。我尝试使用tf_log =跟踪,但找不到任何有用的东西。

这是IoT Hub的TF文件部分:

resource "azurerm_iothub" "iothubhgu" {
  name                = "perf8f17c3iothubhaac"
  resource_group_name = "perf-northeurope"
  location            = "northeurope"

  sku {
    name     = "S3"
    capacity = "10"
  }

  event_hub_partition_count = 128
  event_hub_retention_in_days = 1

  endpoint {
    type                       = "AzureIotHub.StorageContainer"
    connection_string          = azurerm_storage_account.datalakehgu.primary_blob_connection_string
    name                       = "device-twin-changes"
    resource_group_name        = "perf-northeurope"
    batch_frequency_in_seconds = 300
    max_chunk_size_in_bytes    = 134217728
    container_name             = azurerm_storage_container.device_twin_changes.name
    encoding                   = "json"
    file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
  }

   endpoint {
    type                       = "AzureIotHub.StorageContainer"
    connection_string          = azurerm_storage_account.datalakehgu.primary_blob_connection_string
    name                       = "telemetry"
    resource_group_name        = "perf-northeurope"
    batch_frequency_in_seconds = 300
    max_chunk_size_in_bytes    = 134217728
    container_name             = azurerm_storage_container.telemetry.name
    encoding                   = "json"
    file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
  }

  # Endpoint for device telemetry to ingest
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.iothub_ingestion_send.primary_connection_string
    name                = "device-telemetry-to-ingest"
    resource_group_name = "perf-northeurope"
  }

  # Endpoint for all telemetry
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.iothub_all_ingestion_send.primary_connection_string
    name                = "all-telemetry"
    resource_group_name = "perf-northeurope"
  }

  # Endpoint for device telemetry to enrich
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.eventhubauthorizationrulehgu.primary_connection_string
    name                = "device-telemetry-to-enrich"
    resource_group_name = "perf-northeurope"
  }

  # Endpoint for ONT ID changes detection
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.ont_send.primary_connection_string
    name                = "device-ont-changes"
    resource_group_name = "perf-northeurope"
  }

## All endpoint for device twin changes IoTHub
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.iothub_send.primary_connection_string
    name                = "all-device-twin-changes"
    resource_group_name = "perf-northeurope"
  }

  route {
    name           = "device-twin-changes"
    source         = "TwinChangeEvents"
    condition      = "true"
    endpoint_names = ["device-twin-changes"]
    enabled        = true
  }

  route {
    name           = "telemetry"
    source         = "DeviceMessages"
    condition      = "true"
    endpoint_names = ["telemetry"]
    enabled        = true
  }

  # Enrich based on telemetry route
  route {
    name           = "device-telemetry-to-enrich"
    source         = "DeviceMessages"
    condition      = "IS_DEFINED($body.Datablock_id.Device_Info[0].SYSINF_UPT_NUM) AND (NOT IS_DEFINED($twin.tags.shouldAttemptEnrich) OR ($twin.tags.shouldAttemptEnrich = true AND(NOT IS_DEFINED($twin.tags.enrichNextAttemptDate) OR $body.Timestamp_Report > $twin.tags.enrichNextAttemptDate)))"
    endpoint_names = ["device-telemetry-to-enrich"]
    enabled        = true
  }

  # Route for ONT ID changes detection
  route {
    name           = "device-ont-changes"
    source         = "TwinChangeEvents"
    condition      = "IS_DEFINED($body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES) AND (NOT IS_DEFINED($twin.tags.PLOAM_PWD) OR $twin.tags.PLOAM_PWD != $body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES)"
    endpoint_names = ["device-ont-changes"]
    enabled        = true
  }

  # Route for device telemetry to ingest
  route {
    name           = "device-telemetry-to-ingest"
    source         = "DeviceMessages"
    condition      = "IS_ARRAY($body.Datablock_id.Stations_OnDemand)"
    endpoint_names = ["device-telemetry-to-ingest"]
    enabled        = true
  }

 # All routes
  route {
    name           = "all-telemetry"
    source         = "DeviceMessages"
    condition      = "true"
    endpoint_names = ["all-telemetry"]
    enabled        = true
  }

  route {
    name           = "all-device-twin-changes"
    source         = "TwinChangeEvents"
    condition      = "true"
    endpoint_names = ["all-device-twin-changes"]
    enabled        = true
  }

  # Enrich messages
  enrichment {
    key            = "iotHubName"
    value          = "$iothubname"
    endpoint_names = ["device-telemetry-to-enrich", "all-device-twin-changes", "device-ont-changes"]
  }


  lifecycle {
    ignore_changes = [timeouts, shared_access_policy, tags]
  }

  tags = "${merge(map("allocatable_enrollment", "no"), local.tags)}"
}

该计划显示以下内容:

  # azurerm_iothub.iothubhgu must be replaced
-/+ resource "azurerm_iothub" "iothubhgu" {
      ~ endpoint                      = [
          + {
              + batch_frequency_in_seconds = 300
              + connection_string          = "DefaultEndpointsProtocol=https;BlobEndpoint=https://perf8f17c3datalakehaac.blob.core.windows.net/;AccountName=perf8f17c3datalakehaac;AccountKey=1um8iIPDuJwqzKuV160KjkK+GDiRWOS+MN8CL2O74OdARxGNKp7MziZFdgAAGZ7R95K7aDIfBHHCLbhQg4kY+g=="
              + container_name             = "device-twin-changes"
              + encoding                   = "json"
              + file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
              + max_chunk_size_in_bytes    = 134217728
              + name                       = "device-twin-changes"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.StorageContainer"
            },
          + {
              + batch_frequency_in_seconds = 300
              + connection_string          = "DefaultEndpointsProtocol=https;BlobEndpoint=https://perf8f17c3datalakehaac.blob.core.windows.net/;AccountName=perf8f17c3datalakehaac;AccountKey=1um8iIPDuJwqzKuV160KjkK+GDiRWOS+MN8CL2O74OdARxGNKp7MziZFdgAAGZ7R95K7aDIfBHHCLbhQg4kY+g=="
              + container_name             = "telemetry"
              + encoding                   = "json"
              + file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
              + max_chunk_size_in_bytes    = 134217728
              + name                       = "telemetry"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.StorageContainer"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = (known after apply)
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "device-telemetry-to-ingest"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfiothub;SharedAccessKey=EULTnpJs0o2KiT4q3n3kPXs284SfmrOEKcMebbW33no=;EntityPath=all-telemetry"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "all-telemetry"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfiothub;SharedAccessKey=OGoxgak3lEDGVgkZm13qG2CWm8+7NLWLelSYZ5V//pM=;EntityPath=device-telemetry-to-enrich"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "device-telemetry-to-enrich"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfontsend;SharedAccessKey=JIjJxNvTGf4vyyTDhsKEgOPXEIfnQK44aJTolcWTt9c=;EntityPath=device-ont-changes"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "device-ont-changes"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfiothub;SharedAccessKey=13BmqOHQ8VPUTWp7g03bdVQ6DV3/Fre0IDPWq7oajVk=;EntityPath=all-device-twin-changes"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "all-device-twin-changes"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
        ]
      ~ enrichment                    = [
          + {
              + endpoint_names = [
                  + "device-telemetry-to-enrich",
                  + "all-device-twin-changes",
                  + "device-ont-changes",
                ]
              + key            = "iotHubName"
              + value          = "$iothubname"
            },
        ]
      ~ event_hub_events_endpoint     = "sb://iothub-ns-perf8f17c3-18825768-541eda30c9.servicebus.windows.net/" -> (known after apply)
      ~ event_hub_events_path         = "perf8f17c3iothubhaac" -> (known after apply)
      + event_hub_operations_endpoint = (known after apply)
      + event_hub_operations_path     = (known after apply)
        event_hub_partition_count     = 128
        event_hub_retention_in_days   = 1
      ~ hostname                      = "perf8f17c3iothubhaac.azure-devices.net" -> (known after apply)
      ~ id                            = "/subscriptions/8f17c337-c637-4ce1-8703-1161d680e1e0/resourceGroups/perf-northeurope/providers/Microsoft.Devices/IotHubs/perf8f17c3iothubhaac" -> (known after apply)
        location                      = "northeurope"
        name                          = "perf8f17c3iothubhaac"
        resource_group_name           = "perf-northeurope"
      ~ route                         = [
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "device-twin-changes",
                ]
              + name           = "device-twin-changes"
              + source         = "TwinChangeEvents"
            },
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "telemetry",
                ]
              + name           = "telemetry"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "IS_DEFINED($body.Datablock_id.Device_Info[0].SYSINF_UPT_NUM) AND (NOT IS_DEFINED($twin.tags.shouldAttemptEnrich) OR ($twin.tags.shouldAttemptEnrich = true AND(NOT IS_DEFINED($twin.tags.enrichNextAttemptDate) OR $body.Timestamp_Report > $twin.tags.enrichNextAttemptDate)))"
              + enabled        = true
              + endpoint_names = [
                  + "device-telemetry-to-enrich",
                ]
              + name           = "device-telemetry-to-enrich"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "IS_DEFINED($body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES) AND (NOT IS_DEFINED($twin.tags.PLOAM_PWD) OR $twin.tags.PLOAM_PWD != $body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES)"
              + enabled        = true
              + endpoint_names = [
                  + "device-ont-changes",
                ]
              + name           = "device-ont-changes"
              + source         = "TwinChangeEvents"
            },
          + {
              + condition      = "IS_ARRAY($body.Datablock_id.Stations_OnDemand)"
              + enabled        = true
              + endpoint_names = [
                  + "device-telemetry-to-ingest",
                ]
              + name           = "device-telemetry-to-ingest"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "all-telemetry",
                ]
              + name           = "all-telemetry"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "all-device-twin-changes",
                ]
              + name           = "all-device-twin-changes"
              + source         = "TwinChangeEvents"
            },
        ]
      ~ shared_access_policy          = [
          - {
              - key_name      = "iothubowner"
              - permissions   = "RegistryWrite, ServiceConnect, DeviceConnect"
              - primary_key   = "fEMvmPwxLTUgZOHKYamV+PhoR02veW7RsTvQSNDNjCI="
              - secondary_key = "ohnYydzAXI69oi+wP0otb3N8OLOhXeouP27xgxVHekA="
            },
          - {
              - key_name      = "service"
              - permissions   = "ServiceConnect"
              - primary_key   = "qqIZ2TNVowlrdSyU3VntD4yKsX5jy0DfEJzGETkv59A="
              - secondary_key = "00z0H2h9GTcaSRMrU1o6RWtj/Nvz7Ge20694KHpZrw8="
            },
          - {
              - key_name      = "device"
              - permissions   = "DeviceConnect"
              - primary_key   = "aRCojvERyNCwZZI/PMA4FNKGGd5fweH1wbsOxTO8SAo="
              - secondary_key = "cKtniRudwl1LihoLBDZd2vpWiIthgfqxgz7p59Bnzfw="
            },
          - {
              - key_name      = "registryRead"
              - permissions   = "RegistryRead"
              - primary_key   = "UT7NeK+qensRMGLNo5iIRTX2DENStFObF+mwWRO4U4s="
              - secondary_key = "J3hcMbPHpeEWaFxzleTalxytA7gBKRbb71ikqHxTuI4="
            },
          - {
              - key_name      = "registryReadWrite"
              - permissions   = "RegistryWrite"
              - primary_key   = "S+MXnath3mS9sBjSjU4sJqd0dr7UpG1pA/Q5Bb7lS74="
              - secondary_key = "KojXFtEp9R8K+UA9vIGZn7Dc82L6kLdMJIzGOPqlXzg="
            },
        ] -> (known after apply)
        tags                          = {
            "allocatable_enrollment" = "no"
            "environment"            = "perf"
            "maintainer"             = "haac-agent"
            "version"                = "2.3.0-snapshot"
        }
      ~ type                          = "Microsoft.Devices/IotHubs" -> (known after apply)

      ~ cloud_to_device {
          ~ default_ttl        = "PT1H" -> (known after apply)
          ~ max_delivery_count = 10 -> (known after apply)

          ~ feedback {
              ~ lock_duration      = "PT1M" -> (known after apply)
              ~ max_delivery_count = 10 -> (known after apply)
              ~ time_to_live       = "PT1H" -> (known after apply)
            }
        }

      ~ fallback_route {
          ~ condition      = "true" -> (known after apply)
          ~ enabled        = false -> (known after apply)
          ~ endpoint_names = [
              - "events",
            ] -> (known after apply)
          ~ source         = "DeviceMessages" -> (known after apply)
        }

      ~ sku {
          ~ capacity = 1 -> 10
          ~ name     = "S1" -> "S3"
        }

      - timeouts {}
    }

如何防止其更换?使Terraform认为它需要一个新的物联网中心的区别是什么?

I have an IoT Hub on Azure which cannot be deleted. However, starting yesterday, I cannot update the endpoints without recreating the whole IoT Hub. However, Terraform doesn't show me exactly why it needs to recreate it. I've tried using TF_LOG=TRACE but I couldn't find anything useful.

Here is the section of the tf file for the IoT Hub:

resource "azurerm_iothub" "iothubhgu" {
  name                = "perf8f17c3iothubhaac"
  resource_group_name = "perf-northeurope"
  location            = "northeurope"

  sku {
    name     = "S3"
    capacity = "10"
  }

  event_hub_partition_count = 128
  event_hub_retention_in_days = 1

  endpoint {
    type                       = "AzureIotHub.StorageContainer"
    connection_string          = azurerm_storage_account.datalakehgu.primary_blob_connection_string
    name                       = "device-twin-changes"
    resource_group_name        = "perf-northeurope"
    batch_frequency_in_seconds = 300
    max_chunk_size_in_bytes    = 134217728
    container_name             = azurerm_storage_container.device_twin_changes.name
    encoding                   = "json"
    file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
  }

   endpoint {
    type                       = "AzureIotHub.StorageContainer"
    connection_string          = azurerm_storage_account.datalakehgu.primary_blob_connection_string
    name                       = "telemetry"
    resource_group_name        = "perf-northeurope"
    batch_frequency_in_seconds = 300
    max_chunk_size_in_bytes    = 134217728
    container_name             = azurerm_storage_container.telemetry.name
    encoding                   = "json"
    file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
  }

  # Endpoint for device telemetry to ingest
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.iothub_ingestion_send.primary_connection_string
    name                = "device-telemetry-to-ingest"
    resource_group_name = "perf-northeurope"
  }

  # Endpoint for all telemetry
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.iothub_all_ingestion_send.primary_connection_string
    name                = "all-telemetry"
    resource_group_name = "perf-northeurope"
  }

  # Endpoint for device telemetry to enrich
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.eventhubauthorizationrulehgu.primary_connection_string
    name                = "device-telemetry-to-enrich"
    resource_group_name = "perf-northeurope"
  }

  # Endpoint for ONT ID changes detection
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.ont_send.primary_connection_string
    name                = "device-ont-changes"
    resource_group_name = "perf-northeurope"
  }

## All endpoint for device twin changes IoTHub
  endpoint {
    type                = "AzureIotHub.EventHub"
    connection_string   = azurerm_eventhub_authorization_rule.iothub_send.primary_connection_string
    name                = "all-device-twin-changes"
    resource_group_name = "perf-northeurope"
  }

  route {
    name           = "device-twin-changes"
    source         = "TwinChangeEvents"
    condition      = "true"
    endpoint_names = ["device-twin-changes"]
    enabled        = true
  }

  route {
    name           = "telemetry"
    source         = "DeviceMessages"
    condition      = "true"
    endpoint_names = ["telemetry"]
    enabled        = true
  }

  # Enrich based on telemetry route
  route {
    name           = "device-telemetry-to-enrich"
    source         = "DeviceMessages"
    condition      = "IS_DEFINED($body.Datablock_id.Device_Info[0].SYSINF_UPT_NUM) AND (NOT IS_DEFINED($twin.tags.shouldAttemptEnrich) OR ($twin.tags.shouldAttemptEnrich = true AND(NOT IS_DEFINED($twin.tags.enrichNextAttemptDate) OR $body.Timestamp_Report > $twin.tags.enrichNextAttemptDate)))"
    endpoint_names = ["device-telemetry-to-enrich"]
    enabled        = true
  }

  # Route for ONT ID changes detection
  route {
    name           = "device-ont-changes"
    source         = "TwinChangeEvents"
    condition      = "IS_DEFINED($body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES) AND (NOT IS_DEFINED($twin.tags.PLOAM_PWD) OR $twin.tags.PLOAM_PWD != $body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES)"
    endpoint_names = ["device-ont-changes"]
    enabled        = true
  }

  # Route for device telemetry to ingest
  route {
    name           = "device-telemetry-to-ingest"
    source         = "DeviceMessages"
    condition      = "IS_ARRAY($body.Datablock_id.Stations_OnDemand)"
    endpoint_names = ["device-telemetry-to-ingest"]
    enabled        = true
  }

 # All routes
  route {
    name           = "all-telemetry"
    source         = "DeviceMessages"
    condition      = "true"
    endpoint_names = ["all-telemetry"]
    enabled        = true
  }

  route {
    name           = "all-device-twin-changes"
    source         = "TwinChangeEvents"
    condition      = "true"
    endpoint_names = ["all-device-twin-changes"]
    enabled        = true
  }

  # Enrich messages
  enrichment {
    key            = "iotHubName"
    value          = "$iothubname"
    endpoint_names = ["device-telemetry-to-enrich", "all-device-twin-changes", "device-ont-changes"]
  }


  lifecycle {
    ignore_changes = [timeouts, shared_access_policy, tags]
  }

  tags = "${merge(map("allocatable_enrollment", "no"), local.tags)}"
}

And the plan shows the following:

  # azurerm_iothub.iothubhgu must be replaced
-/+ resource "azurerm_iothub" "iothubhgu" {
      ~ endpoint                      = [
          + {
              + batch_frequency_in_seconds = 300
              + connection_string          = "DefaultEndpointsProtocol=https;BlobEndpoint=https://perf8f17c3datalakehaac.blob.core.windows.net/;AccountName=perf8f17c3datalakehaac;AccountKey=1um8iIPDuJwqzKuV160KjkK+GDiRWOS+MN8CL2O74OdARxGNKp7MziZFdgAAGZ7R95K7aDIfBHHCLbhQg4kY+g=="
              + container_name             = "device-twin-changes"
              + encoding                   = "json"
              + file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
              + max_chunk_size_in_bytes    = 134217728
              + name                       = "device-twin-changes"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.StorageContainer"
            },
          + {
              + batch_frequency_in_seconds = 300
              + connection_string          = "DefaultEndpointsProtocol=https;BlobEndpoint=https://perf8f17c3datalakehaac.blob.core.windows.net/;AccountName=perf8f17c3datalakehaac;AccountKey=1um8iIPDuJwqzKuV160KjkK+GDiRWOS+MN8CL2O74OdARxGNKp7MziZFdgAAGZ7R95K7aDIfBHHCLbhQg4kY+g=="
              + container_name             = "telemetry"
              + encoding                   = "json"
              + file_name_format           = "year={YYYY}/month={MM}/day={DD}/hour={HH}/{iothub}-{partition}-{mm}"
              + max_chunk_size_in_bytes    = 134217728
              + name                       = "telemetry"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.StorageContainer"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = (known after apply)
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "device-telemetry-to-ingest"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfiothub;SharedAccessKey=EULTnpJs0o2KiT4q3n3kPXs284SfmrOEKcMebbW33no=;EntityPath=all-telemetry"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "all-telemetry"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfiothub;SharedAccessKey=OGoxgak3lEDGVgkZm13qG2CWm8+7NLWLelSYZ5V//pM=;EntityPath=device-telemetry-to-enrich"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "device-telemetry-to-enrich"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfontsend;SharedAccessKey=JIjJxNvTGf4vyyTDhsKEgOPXEIfnQK44aJTolcWTt9c=;EntityPath=device-ont-changes"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "device-ont-changes"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
          + {
              + batch_frequency_in_seconds = null
              + connection_string          = "Endpoint=sb://perf8f17c3agenthaac.servicebus.windows.net/;SharedAccessKeyName=perfiothub;SharedAccessKey=13BmqOHQ8VPUTWp7g03bdVQ6DV3/Fre0IDPWq7oajVk=;EntityPath=all-device-twin-changes"
              + container_name             = null
              + encoding                   = null
              + file_name_format           = null
              + max_chunk_size_in_bytes    = null
              + name                       = "all-device-twin-changes"
              + resource_group_name        = "perf-northeurope"
              + type                       = "AzureIotHub.EventHub"
            },
        ]
      ~ enrichment                    = [
          + {
              + endpoint_names = [
                  + "device-telemetry-to-enrich",
                  + "all-device-twin-changes",
                  + "device-ont-changes",
                ]
              + key            = "iotHubName"
              + value          = "$iothubname"
            },
        ]
      ~ event_hub_events_endpoint     = "sb://iothub-ns-perf8f17c3-18825768-541eda30c9.servicebus.windows.net/" -> (known after apply)
      ~ event_hub_events_path         = "perf8f17c3iothubhaac" -> (known after apply)
      + event_hub_operations_endpoint = (known after apply)
      + event_hub_operations_path     = (known after apply)
        event_hub_partition_count     = 128
        event_hub_retention_in_days   = 1
      ~ hostname                      = "perf8f17c3iothubhaac.azure-devices.net" -> (known after apply)
      ~ id                            = "/subscriptions/8f17c337-c637-4ce1-8703-1161d680e1e0/resourceGroups/perf-northeurope/providers/Microsoft.Devices/IotHubs/perf8f17c3iothubhaac" -> (known after apply)
        location                      = "northeurope"
        name                          = "perf8f17c3iothubhaac"
        resource_group_name           = "perf-northeurope"
      ~ route                         = [
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "device-twin-changes",
                ]
              + name           = "device-twin-changes"
              + source         = "TwinChangeEvents"
            },
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "telemetry",
                ]
              + name           = "telemetry"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "IS_DEFINED($body.Datablock_id.Device_Info[0].SYSINF_UPT_NUM) AND (NOT IS_DEFINED($twin.tags.shouldAttemptEnrich) OR ($twin.tags.shouldAttemptEnrich = true AND(NOT IS_DEFINED($twin.tags.enrichNextAttemptDate) OR $body.Timestamp_Report > $twin.tags.enrichNextAttemptDate)))"
              + enabled        = true
              + endpoint_names = [
                  + "device-telemetry-to-enrich",
                ]
              + name           = "device-telemetry-to-enrich"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "IS_DEFINED($body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES) AND (NOT IS_DEFINED($twin.tags.PLOAM_PWD) OR $twin.tags.PLOAM_PWD != $body.properties.reported.Datablock_id.Device_Info.PLOAM_PWD_DES)"
              + enabled        = true
              + endpoint_names = [
                  + "device-ont-changes",
                ]
              + name           = "device-ont-changes"
              + source         = "TwinChangeEvents"
            },
          + {
              + condition      = "IS_ARRAY($body.Datablock_id.Stations_OnDemand)"
              + enabled        = true
              + endpoint_names = [
                  + "device-telemetry-to-ingest",
                ]
              + name           = "device-telemetry-to-ingest"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "all-telemetry",
                ]
              + name           = "all-telemetry"
              + source         = "DeviceMessages"
            },
          + {
              + condition      = "true"
              + enabled        = true
              + endpoint_names = [
                  + "all-device-twin-changes",
                ]
              + name           = "all-device-twin-changes"
              + source         = "TwinChangeEvents"
            },
        ]
      ~ shared_access_policy          = [
          - {
              - key_name      = "iothubowner"
              - permissions   = "RegistryWrite, ServiceConnect, DeviceConnect"
              - primary_key   = "fEMvmPwxLTUgZOHKYamV+PhoR02veW7RsTvQSNDNjCI="
              - secondary_key = "ohnYydzAXI69oi+wP0otb3N8OLOhXeouP27xgxVHekA="
            },
          - {
              - key_name      = "service"
              - permissions   = "ServiceConnect"
              - primary_key   = "qqIZ2TNVowlrdSyU3VntD4yKsX5jy0DfEJzGETkv59A="
              - secondary_key = "00z0H2h9GTcaSRMrU1o6RWtj/Nvz7Ge20694KHpZrw8="
            },
          - {
              - key_name      = "device"
              - permissions   = "DeviceConnect"
              - primary_key   = "aRCojvERyNCwZZI/PMA4FNKGGd5fweH1wbsOxTO8SAo="
              - secondary_key = "cKtniRudwl1LihoLBDZd2vpWiIthgfqxgz7p59Bnzfw="
            },
          - {
              - key_name      = "registryRead"
              - permissions   = "RegistryRead"
              - primary_key   = "UT7NeK+qensRMGLNo5iIRTX2DENStFObF+mwWRO4U4s="
              - secondary_key = "J3hcMbPHpeEWaFxzleTalxytA7gBKRbb71ikqHxTuI4="
            },
          - {
              - key_name      = "registryReadWrite"
              - permissions   = "RegistryWrite"
              - primary_key   = "S+MXnath3mS9sBjSjU4sJqd0dr7UpG1pA/Q5Bb7lS74="
              - secondary_key = "KojXFtEp9R8K+UA9vIGZn7Dc82L6kLdMJIzGOPqlXzg="
            },
        ] -> (known after apply)
        tags                          = {
            "allocatable_enrollment" = "no"
            "environment"            = "perf"
            "maintainer"             = "haac-agent"
            "version"                = "2.3.0-snapshot"
        }
      ~ type                          = "Microsoft.Devices/IotHubs" -> (known after apply)

      ~ cloud_to_device {
          ~ default_ttl        = "PT1H" -> (known after apply)
          ~ max_delivery_count = 10 -> (known after apply)

          ~ feedback {
              ~ lock_duration      = "PT1M" -> (known after apply)
              ~ max_delivery_count = 10 -> (known after apply)
              ~ time_to_live       = "PT1H" -> (known after apply)
            }
        }

      ~ fallback_route {
          ~ condition      = "true" -> (known after apply)
          ~ enabled        = false -> (known after apply)
          ~ endpoint_names = [
              - "events",
            ] -> (known after apply)
          ~ source         = "DeviceMessages" -> (known after apply)
        }

      ~ sku {
          ~ capacity = 1 -> 10
          ~ name     = "S1" -> "S3"
        }

      - timeouts {}
    }

How can I prevent it to be replaced? What is the difference that is making Terraform think that it needs a new IoT Hub?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文