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

[WIP] build provider_meta feature into provider #474

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

drewmullen
Copy link

@drewmullen drewmullen commented Apr 25, 2022

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Relates OR Closes #473, #466

@drewmullen drewmullen changed the title [WIP] build provider_meta feturea into provider [WIP] build provider_meta feature into provider Apr 25, 2022
@drewmullen
Copy link
Author

$ make build && cp $GOPATH/bin/terraform-provider-awscc ~/.terraform.d/plugins/providermeta/hashicorp/awscc/0.0.1/darwin_amd64/
go install
# github.com/hashicorp/terraform-provider-awscc
./main.go:11:32: cannot use provider.New (type func() tfsdk.ProviderWithProviderMeta) as type func() tfsdk.Provider in argument to tfsdk.Serve
make: *** [build] Error 2

@@ -23,7 +23,7 @@ const (
defaultAssumeRoleDuration = 1 * time.Hour
)

func New() tfsdk.Provider {
func New() tfsdk.ProviderWithProviderMeta {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can still return tfsdk.Provider here. As long as GetMetaSchema is defined on AwsCloudControlApiProvider, it will still fulfill the tfsdk.ProviderWithProviderMeta interface

@drewmullen
Copy link
Author

Unable to figure out how to extract the hcl provider_meta set in test TestAccAWSEC2VPC_metadata. I believe there is something going on here:

https://github.com/hashicorp/terraform-plugin-framework/blob/5c07e076830a6e13f46b356c4a11439382760a85/internal/proto6server/serve.go#L1236-L1239

I'm pretty sure the function applyResourceChange should be able to see the ProviderMeta content from the req *tfprotov6.ApplyResourceChangeRequest but its not populating there, despite the schema getting there.

Once the data is there, i think we have the functionality in place to unpack and add to the new ctx key for user-agent additions

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

Successfully merging this pull request may close these issues.

Optionally specify additional user agent details using ProviderMeta
2 participants