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

Custom provider built with terraform-plugin-framework does not find resource/data source types with TF 1.6 #33990

Closed
dhohengassner opened this issue Oct 5, 2023 · 10 comments
Labels
bug v1.6 Issues (primarily bugs) reported against v1.6 releases
Milestone

Comments

@dhohengassner
Copy link

Terraform Version

1.6.0

Terraform Configuration Files

resource "custom_service" "my_service" {
  display_name  = "Custom Service"
  description   = "Test Custom Service"
}

Debug Output

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.
##### Running 'terraform apply --auto-approve' ################################################################
2023-10-05T13:51:54.060Z [ERROR] provider.terraform-provider-customiam: Response contains error diagnostic: diagnostic_severity=ERROR @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/diag/diagnostics.go:58 tf_proto_version=6.4 tf_req_id=748e53e1-c5cf-fcc4-135f-563bb7db7de4 tf_rpc=ValidateResourceConfig @module=sdk.proto diagnostic_summary="Resource Type Not Found" tf_provider_addr=app.terraform.io/rbmh-mit/customiam tf_resource_type=example_service diagnostic_detail="No resource type named \"example_service\" was found in the provider." timestamp=2023-10-05T13:51:54.060Z
2023-10-05T13:51:54.060Z [ERROR] provider.terraform-provider-customiam: Response contains error diagnostic: tf_provider_addr=app.terraform.io/rbmh-mit/customiam tf_rpc=ValidateResourceConfig @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/diag/diagnostics.go:58 tf_req_id=c4075578-dba7-128a-6a2d-7637e983c6a2 @module=sdk.proto diagnostic_detail="No resource type named \"example_service\" was found in the provider." diagnostic_summary="Resource Type Not Found" tf_proto_version=6.4 diagnostic_severity=ERROR tf_resource_type=example_service timestamp=2023-10-05T13:51:54.060Z
2023-10-05T13:51:54.060Z [ERROR] vertex "example_service.example_service1" error: Resource Type Not Found
2023-10-05T13:51:54.060Z [ERROR] vertex "example_service.example_service2" error: Resource Type Not Found
╷
│ Error: Resource Type Not Found
│ 
│   with example_service.example_service1,
│   on resource-service.tf line 1, in resource "example_service" "example_service1":
│    1: resource "example_service" "example_service1" {
│ 
│ No resource type named "example_service" was found in the provider.

Expected Behavior

Provider works fine as it does with Terraform v1.5

Actual Behavior

The same provider binary crashes with errors:

No resource type named "custom_service" was found in the provider

Steps to Reproduce

terraform init
terraform apply

Additional Context

The provider was built this year on top of the latest framework.

https://github.com/hashicorp/terraform-plugin-framework

References

No response

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

jbardin commented Oct 5, 2023

Hi @dhohengassner,

Thanks for filing the issue. I think we're going to need a more complete example to figure out what might be going on here. The provider is what is returning the error message, so it's not clear yet what Terraform could be doing differently to cause it. It looks like you have obfuscated the output a bit, but if the provider is called custom, it would normally have resources named custom_service, however the configuration in the error shows example_service which isn't going to match resources in the provider.

@jbardin jbardin added waiting-response An issue/pull request is waiting for a response from the community waiting for reproduction unable to reproduce issue without further information labels Oct 5, 2023
@dhohengassner
Copy link
Author

Hey @jbardin,

Thanks for the quick response and sorry for not mentioning the adjustments earlier.

Yeah, you are right; I obfuscated the resource name as well as the output (and not even well 👎 ) since it is an internal provider not meant for public use.
The resources and data sources are found fine with 1.5 and older terraform versions; I have now pinned the version and it works with the same binary.

The resource/provider names are the only thing I adjusted; the rest of the output comes from an actual pipeline.
Is there anything else I can provide in addition to the logs that would help?

I'm also curious if other providers using the framework will run into the same issue.
Thanks!

@jbardin
Copy link
Member

jbardin commented Oct 5, 2023

I haven't heard of anything similar with the framework, and haven't come up with any hypotheses yet about what could be happening either. Are you on the latest release of the framework?

If it's possible to put together a minimal config, and a full trace log from the plan, that may help pinpoint what is going on.

@apparentlymart apparentlymart added the v1.6 Issues (primarily bugs) reported against v1.6 releases label Oct 5, 2023
@andrewesweet
Copy link

I can replicated this with 1.6.0-beta2 and later by using the data source from https://github.com/hashicorp/terraform-provider-scaffolding-framework without change.

@drbild
Copy link

drbild commented Oct 5, 2023

We're seeing the same issue with both our public provider and a private, internal-use-only, provider.

@jbardin
Copy link
Member

jbardin commented Oct 5, 2023

Thanks @andrewesweet, the scaffolding example should work as a good starting point!

@apparentlymart apparentlymart added this to the v1.6.1 milestone Oct 6, 2023
@apparentlymart
Copy link
Contributor

apparentlymart commented Oct 6, 2023

Hi all,

Detailed investigation of this one is still ongoing, but based on internal discussion it seems like this is a bug in the plugin framework itself but it appears as new in Terraform v1.6.0 because this new Terraform Core release introduced a new provider protocol feature which the framework is attempting to use but is using it incorrectly, causing this error.

Based on the information in the framework's changelog it seems like building your providers using framework release v1.3.5 should avoid this problem for now, since the problematic use of the new protocol feature came in v1.4.0.

There are folks on the framework dev team digging deeper into this currently, and hopefully we'll have a fix coming soon. The fix is likely to be in the framework primarily, and so will probably require upgrading to a newer version of the framework once fixed, but I'll let the folks working on it share more information about what's required once the details are clearer.

Thanks again for reporting this!

@austinvalle
Copy link
Member

Hi all 👋🏻 ,

I've opened a bug report for further tracking of this issue: hashicorp/terraform-plugin-framework#853

Also wanted to add that if you downgrade terraform-plugin-framework to v1.3.5, you should also downgrade terraform-plugin-go to v0.18.0 to avoid a build error:

go get -u github.com/hashicorp/terraform-plugin-framework@v1.3.5
go get -u github.com/hashicorp/terraform-plugin-go@v0.18.0

@jbardin
Copy link
Member

jbardin commented Oct 6, 2023

Hello,

Since there's not going to be any associated change in core to fix the errors here, I'm going to close this issue. Interested parties can follow hashicorp/terraform-plugin-framework#853 for a resolution in the plugin-framework.

Thanks!

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 v1.6 Issues (primarily bugs) reported against v1.6 releases
Projects
None yet
Development

No branches or pull requests

6 participants