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

Setting the vars property on the dog_host resource to an empty JSON object produces an error #95

Open
weaversam8 opened this issue Mar 21, 2024 · 1 comment

Comments

@weaversam8
Copy link
Member

If you attempt to create a resource like this:

resource "dog_host" "abc" {
  name = "abc.example.com"
  vars = jsonencode({})
}

Terraform will produce an error like:

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to dog_host.abc, provider "provider[\"registry.terraform.io/relaypro-open/dog\"]" produced an
│ unexpected new value: .vars: was cty.StringVal("{}"), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
@dgulinobw
Copy link
Contributor

This is a bug, in that the provider returns an error instead of usable information.

vars is not a required field. If vars has no values, simply do not add that field to the host definition.

This host with no vars defined will work:

resource "dog_host" "d123" {
  name = "d123.example.com"
  environment = "*"
  group       = dog_group.dog_test.name
  hostkey     = "1234567890"
  location    = "*"
  provider    = dog.qa
}

Also, the jsonecoding workaround of the lack of dynamic (any) support in terraform can now go away, since in 1.7.0 dynamics are now supported:
https://developer.hashicorp.com/terraform/language/expressions/type-constraints#dynamic-types-the-any-constraint

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

No branches or pull requests

2 participants