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

Terraform 1.6.0 broke custom Terraform provider using protocol 6 #34013

Closed
spkane opened this issue Oct 6, 2023 · 3 comments
Closed

Terraform 1.6.0 broke custom Terraform provider using protocol 6 #34013

spkane opened this issue Oct 6, 2023 · 3 comments
Labels
bug duplicate issue closed because another issue already tracks this problem

Comments

@spkane
Copy link

spkane commented Oct 6, 2023

Terraform Version

Terraform v1.6.0
on darwin_arm64
+ provider registry.terraform.io/spkane/todo v2.0.4

Terraform Configuration Files

terraform {
  required_providers {
    todo = {
      source  = "spkane/todo"
      version = "2.0.4"
    }
  }
}

provider "todo" {
  host = "127.0.0.1"
  port = "8080"
  apipath = "/"
  schema = "http"
}

data "todo_todo" "foreign" {
  id = 1
}

resource "todo_todo" "test1" {
  count = 5
  description = "${count.index}-1 ${var.purpose} todo"
  completed = false
}

resource "todo_todo" "test2" {
  count = 5
  description = "${count.index}-2 ${var.purpose} todo (linked to ${data.todo_todo.foreign.description})"
  completed = false
}

output "todo_1_ids" {
  value = todo_todo.test1.*.id
}

output "todo_2_ids" {
  value = todo_todo.test2.*.id
}

variable "purpose" {
    type = string
    description = "Tag the purpose of this todo"
    default = "test"
}

Debug Output

https://gist.github.com/spkane/61273fc4b7bc130d03df7bf1af5c4982

Expected Behavior

The provider spkane/todo v2.0.4 works fine with Terraform 1.5.7. I would expect it to continue to work with Terraform 1.6.0.

Actual Behavior

$ terraform plan
╷
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│  - spkane/todo in /Users/spkane/dev/spkane/terraform-provider-todo
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published
│ releases.
╵
╷
│ Error: Data Source Type Not Found
│
│   with data.todo_todo.foreign,
│   on main.tf line 17, in data "todo_todo" "foreign":
│   17: data "todo_todo" "foreign" {
│
│ No data source type named "todo_todo" was found in the provider.
╵
╷
│ Error: Resource Type Not Found
│
│   with todo_todo.test1,
│   on main.tf line 21, in resource "todo_todo" "test1":
│   21: resource "todo_todo" "test1" {
│
│ No resource type named "todo_todo" was found in the provider.
╵

From what I can tell this might be due to 1.6.0 no longer asking for the provider schema and the related changes. #33486

I think that I might need to set get_provider_schema_optional via ServerCapabilities, but honestly I wasn't sure how to go about that, or if there was some other issue that was leading to this.

Any pointers would be appreciated if the issue is in the provider.

I could not find any documentation besides the code, on using ServerCapabilities properly.

Steps to Reproduce

  1. docker compose up -d # spin up the API server locally.
  2. terraform init
  3. terraform apply

Additional Context

Not really. The same results occur using provider version 2.0.4 on the registry or using a local dev copy (which I was using when I wrote up this issue).

I also was using a local copy of the simple API, running in a container, to test things.

References

#33486

@spkane spkane added bug new new issue not yet triaged labels Oct 6, 2023
@jbardin
Copy link
Member

jbardin commented Oct 6, 2023

Duplicate of #33990

@jbardin jbardin marked this as a duplicate of #33990 Oct 6, 2023
@jbardin jbardin closed this as completed Oct 6, 2023
@spkane
Copy link
Author

spkane commented Oct 6, 2023

@crw crw added duplicate issue closed because another issue already tracks this problem and removed new new issue not yet triaged labels Oct 6, 2023
Copy link
Contributor

github-actions bot commented Dec 9, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug duplicate issue closed because another issue already tracks this problem
Projects
None yet
Development

No branches or pull requests

3 participants