这是indexloc提供的服务,不要输入任何密码
Skip to content

vercel_dns_record "domain" variable handling bug, string works #48

@iancleary

Description

@iancleary

Hello 👋🏼 ,

First off, thank you for providing this terraform module 😄 .

I ran into an issue with the vercel_dns_record resource, and believe it is a bug.
If there is a reason it's a feature, please let me know.

Issue

I am able to successfully create/update records on the vercel_dns_record resource when the domain variable is a hard coded string, but not when the value comes from a terraform.tfvars file (living next to the main.tf file that creates the resource) used as var.domain, etc..

Context on versions and steps to reproduce

Version 0.6.0 and loading my token from a file.

versions.tf

terraform {
  required_providers {
    vercel = {
      source = "vercel/vercel"
      version = "0.6.0"
    }
  }
}

provider "vercel" {
  # https://vercel.com/account/tokens
  api_token = yamldecode(file("~/.config/tokens/vercel.yaml"))["token"]
}

I've confirmed that I have the 3rd party domain setup in Vercel. The bug/issue isn't related to that initial creation of the domain, but rather variable inputs to the vercel_dns_record resource.

terraform.tfvars contains a variable for the domain I'm looking to add records to.

domain = "iancleary.me"
host   = "box"

Main terraform file declaring resource:

resource "vercel_dns_record" "mx" {
  domain = var.domain
  type   = "MX"
  ttl    = 60
  value  = format("%s.%s",var.host,var.domain)
  name   = ""
  mx_priority = 10
}

run plan and encounter error

command

terraform plan

output

╷
│ Error: Value Conversion Error
│
│   with module.mail_in_a_box_dns.vercel_dns_record.mx,
│   on modules\mail-in-a-box-dns\main.tf line 2, in resource "vercel_dns_record" "mx":2:   domain = var.domain
│
│ 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:
│
│ unhandled unknown value

What does work

resource "vercel_dns_record" "mx" {
  domain = "iancleary.me"
  type   = "MX"
  ttl    = 60
  value  = "box.iancleary.me"
  name   = ""
  mx_priority = 10
}

What did I expect to happen

I was expecting the vercel_dns_record resource to handle variables being provided as inputs, but unhandled unknown value is written to the console. Given the prompt from terraform to report the bug, this issue aims to do that, providing you the information necessary to reproduce.

Please let me know if you need any other information from me.

Thanks!

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