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

Value Conversion Error using a dynamic block on evaluation_schedule in honeycombio_trigger resource #537

Closed
rutomo-humi opened this issue Aug 26, 2024 · 2 comments · Fixed by #539
Labels

Comments

@rutomo-humi
Copy link

rutomo-humi commented Aug 26, 2024

Terraform Validate/Plan receives the following Value Conversion Error whenever I tried to use dynamic block on evaluation_schedule in honeycombio_trigger

terraform init && terraform plan
Initializing the backend...
Initializing provider plugins...
- Reusing previous version of honeycombio/honeycombio from the dependency lock file
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using previously-installed honeycombio/honeycombio v0.27.0
- Using previously-installed hashicorp/aws v5.64.0

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
╷
│ Error: Value Conversion Error
│ 
│   with honeycombio_trigger.this,
│   on main.tf line 44, in resource "honeycombio_trigger" "this":
│   44: resource "honeycombio_trigger" "this" {
│ 
│ An unexpected error was encountered trying to build a value. This is always an error in the provider.
│ Please report the following to the provider developer:
│ 
│ Received unknown value, however the target type cannot handle unknown values. Use the corresponding
│ `types` package type or a custom type that handles unknown values.
│ 
│ Path: evaluation_schedule
│ Target Type: []models.TriggerEvaluationScheduleModel
│ Suggested Type: basetypes.ListValue
╵
terraform validate
╷
│ Error: Value Conversion Error
│ 
│   with honeycombio_trigger.this,
│   on main.tf line 44, in resource "honeycombio_trigger" "this":
│   44: resource "honeycombio_trigger" "this" {
│ 
│ An unexpected error was encountered trying to build a value. This is always an error in the provider.
│ Please report the following to the provider developer:
│ 
│ Received unknown value, however the target type cannot handle unknown values. Use the corresponding
│ `types` package type or a custom type that handles unknown values.
│ 
│ Path: evaluation_schedule
│ Target Type: []models.TriggerEvaluationScheduleModel
│ Suggested Type: basetypes.ListValue

Versions
This affects honeycombio provider version 0.24.0 or higher. We were on 0.21.0 and was only able to update to version 0.23.0 as we keep running into the Value Conversion Error.

terraform --version
Terraform v1.9.3
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.64.0
+ provider registry.terraform.io/honeycombio/honeycombio v0.27.0

Steps to reproduce

locals {
  dataset = "dataset"
  business_hour = {
    start_time = "14:00" # 9:00 EST
    end_time   = "22:00" # 17:00 EST
    days_of_week = [
      "monday",
      "tuesday",
      "wednesday",
      "thursday",
      "friday",
    ]
  }
}

variable "enable_evaluation_schedule_business_hour" {
  type    = bool
  default = true
}

resource "honeycombio_query" "this" {
  dataset    = local.dataset
  query_json = data.honeycombio_query_specification.this.json
}

resource "honeycombio_trigger" "this" {
  name = "test-trigger"

  query_id = honeycombio_query.this.id
  dataset  = local.dataset

  threshold {
    exceeded_limit = 1
    op             = ">"
    value          = "0"
  }

  dynamic "evaluation_schedule" {
    for_each = var.enable_evaluation_schedule_business_hour ? [true] : []

    content {
      start_time   = local.business_hour.start_time
      end_time     = local.business_hour.end_time
      days_of_week = local.business_hour.days_of_week
    }
  }
}

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.64"
    }
    honeycombio = {
      source  = "honeycombio/honeycombio"
      version = "~> 0.27.0"
    }
  }
}

Additional context

When I didn't use dynamic block for evaluation_schedule, it worked fine

  evaluation_schedule {
    start_time   = local.business_hour.start_time
    end_time     = local.business_hour.end_time
    days_of_week = local.business_hour.days_of_week
  }
@jharley
Copy link
Collaborator

jharley commented Sep 3, 2024

Thanks for taking the time to pull together such a complete bug report, @rutomo-humi!

I just merged the fix for this and we'll get it out shortly in a patch release.

@jharley
Copy link
Collaborator

jharley commented Sep 3, 2024

The fix for this was just released in v0.27.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@jharley @rutomo-humi and others