Skip to content

Probably incorrect yandex_ydb_topic import #596

@mooncube

Description

@mooncube

Hello.

I'm trying to import YDB topic into existing configuration defining YDB database and related resources.

The code is:

resource "yandex_ydb_topic" "trail_logs_stream" {
  database_endpoint = yandex_ydb_database_serverless.stream_db.ydb_full_endpoint
  name              = "trail-logs-stream"
  max_partitions_count = 3
}

import {
  to = module.platform.yandex_ydb_topic.trail_logs_stream
  id = "grpcs://ydb.serverless.yandexcloud.net:2135/?database=/ru-central1/...../.....?path=trail-logs-stream"
}

The id database part is 100% the same as the yandex_ydb_database_serverless.stream_db.ydb_full_endpoint.

This results in the following plan:

  # Warning: this will destroy the imported resource
-/+ resource "yandex_ydb_topic" "trail_logs_stream" {
      + database_endpoint          = "grpcs://ydb.serverless.yandexcloud.net:2135/?database=/ru-central1/...../....." # forces replacement
      ~ id                         = "grpcs://ydb.serverless.yandexcloud.net:2135/?database=/ru-central1/...../.....?path=trail-logs-stream" -> (known after apply)
      ~ max_partitions_count       = 1 -> 3
      ~ metering_mode              = "request_units" -> (known after apply)
      + name                       = "trail-logs-stream" # forces replacement
      ~ partition_write_speed_kbps = 1024 -> (known after apply)
      ~ partitions_count           = 3 -> (known after apply)
      ~ retention_period_hours     = 168 -> (known after apply)
      ~ retention_storage_mb       = 65536 -> (known after apply)
      ~ supported_codecs           = [
          - "raw",
        ] -> (known after apply)

      ~ auto_partitioning_settings (known after apply)
      - auto_partitioning_settings {
          - auto_partitioning_strategy = "DISABLED" -> null

          - auto_partitioning_write_speed_strategy {
              - down_utilization_percent = 20 -> null
              - stabilization_window     = 300 -> null
              - up_utilization_percent   = 80 -> null
            }
        }

      ~ consumer (known after apply)
      - consumer {
          - important                     = false -> null
          - name                          = "......" -> null
          - starting_message_timestamp_ms = 0 -> null
          - supported_codecs              = [
              - "raw",
            ] -> null
        }
    }

So:

  • the ID of the resource is correct;
  • the database endpoint and name attributes are shown as + for some reason;
  • the plan suggests recreating the resource.

Tested on different Terraform (including 1.14.4) and Yandex Cloud provider (including 0.188.0) versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions