Aws_quicksight_refresh_schedule terraform dynamic block issue for refresh_on_day

Using a terraform dynamic block in the aws_quicksight_refresh_schedule resource for refresh_on_day is throwing a value conversion error

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:
│ Target Type: []quicksight.refreshOnDayData
│ Suggested Type: basetypes.ListValue

my code –

schedule {
    refresh_type = each.value.refresh.type
    schedule_frequency {
      interval        = each.value.refresh.interval
      time_of_the_day = each.value.refresh.time_of_day
      timezone        = each.value.refresh.timezone
      dynamic "refresh_on_day" {
        for_each = each.value.refresh.interval == "WEEKLY" || each.value.refresh.interval == "MONTHLY" ? [1] : []
        content {
          day_of_week  = try(each.value.refresh.interval == "WEEKLY" ? each.value.refresh.refresh_on_day : null, null)
          day_of_month = try(each.value.refresh.interval == "MONTHLY" ? each.value.refresh.refresh_on_day : null, null)
        }
      }
    }
  }

My for_each variable looks like –

analytic-tables = {
  "analytic-output" : {
    description = "Description 1"
    location    = "folder/output-1/"
    refresh = {
      column_name      = "date"
      window_size      = "1"
      window_size_unit = "DAY"
      type             = "INCREMENTAL_REFRESH"
      interval         = "DAILY"
      time_of_day      = "02:00"
      timezone         = "America/New_York"
      refresh_on_day   = ""
    }
    columns = [
      {
        name  = "date"
        type = "datetime"
      },
      {
        name = "run_date"
        type = "datetime"
      }
    ]
  },
  "runids" : {
    description = "Description 2"
    location    = "folder/output-2"
    refresh = {
      type           = "FULL_REFRESH"
      interval       = "WEEKLY"
      time_of_day    = "02:00"
      timezone       = "America/New_York"
      refresh_on_day = "Monday"
    }
    columns = [
      {
        name = "site"
        type = "string"
      },
      {
        name  = "birth_year"
        type  = "bigint"
        qtype = "integer"
      }
    ]
  }
}

Any help would be greatly appreciated.
Thank you

@think_tank_77 I think it might be a terraform problem, but you can try boto3 API or CLI to do the same to drill down the problem.

https://boto3.amazonaws.com/v1/documentation/api/1.26.120/reference/services/quicksight/client/create_refresh_schedule.html

Thank you @neelay. I was hoping to find a terraform fix or thinking something I was incorrectly writing the resource block. I can probably use a local-exec provisioner to run a CLI command to create the refresh schedule (was trying to avoid provisioners).

Hi @think_tank_77, welcome to the Quick Sight Community. Maybe these links can help:

Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the Quick Sight Community!

Not quite. Issue is with using dynamic block for refresh_on_day attribute (not the resource block itself). I implemented a local-exec provisioner now to work around the problem I have (not something I want to do but works for now). It is not a solution for the problem but I took @neealy’s advice and used CLI to address it.