nats-io / terraform-provider-jetstream

Terraform Provider to manage NATS JetStream
Apache License 2.0
55 stars 13 forks source link

sample_freq param required on import #69

Closed rayjanoka closed 1 year ago

rayjanoka commented 2 years ago

Seems like the consumer sample_freq setting is required to be set on the infrastructure to run terraform import or apply after import.

➜ terraform import jetstream_consumer.archie_consumer JETSTREAM_STREAM_archie-stream_CONSUMER_archie-consumer
╷
│ Error: failed to parse consumer sampling configuration: strconv.Atoi: parsing "": invalid syntax
│
│   with jetstream_consumer.archie_consumer,
│   on archie.tf line 114, in resource "jetstream_consumer" "archie_consumer":
│  114: resource "jetstream_consumer" "archie-consumer-b2" {
│
╵

The consumer that I'm importing did not have the sample_freq configuration set, it is not listed.

➜ nats consumer info archie-stream archie-consumer --json
{
  "stream_name": "archie-stream",
  "name": "archie-consumer",
  "config": {
    "ack_policy": "explicit",
    "ack_wait": 2700000000000,
    "deliver_policy": "new",
    "durable_name": "archie-consumer",
    "name": "archie-consumer",
    "filter_subject": "minio-events",
    "max_ack_pending": 1000,
    "max_deliver": -1,
    "max_waiting": 512,
    "replay_policy": "instant",
    "num_replicas": 0
  },
...

After I set the sample_freq on the consumer I'm able to run terraform successfully.

➜ nats consumer edit archie-stream archie-consumer --sample=100