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

add provider meta schema with module_name field #197

Merged
merged 5 commits into from
Oct 20, 2021

Conversation

bcmdarroch
Copy link
Contributor

@bcmdarroch bcmdarroch commented Sep 16, 2021

🛠️ Description

This PR adds the ProviderMeta schema block to the provider config. This includes the optional field module_name, which will be added to a user agent used by analytics.

Also adds a helper that handles getting the ProviderMeta in a resource and adds the module name to the user agent. This helper must be added to each resource individually. It currently lives in the Consul cluster, HVN peering, and HVN route.

🚢 Release Note

Release note for CHANGELOG:

NONE

🏗️ Acceptance tests

  • Are there any feature flags that are required to use this functionality?
  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccConsulCluster'

--- PASS: TestAccConsulCluster (1086.66s)
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider	1087.046s

@bcmdarroch bcmdarroch requested a review from a team September 16, 2021 00:12
Copy link
Contributor

@lackeyjb lackeyjb left a comment

Choose a reason for hiding this comment

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

👍

@bcmdarroch bcmdarroch force-pushed the add-module-to-provider-schema branch from 7c35f42 to 9ae6313 Compare October 14, 2021 23:35
@bcmdarroch bcmdarroch requested review from a team as code owners October 14, 2021 23:35
@bcmdarroch bcmdarroch force-pushed the add-module-to-provider-schema branch from 9ae6313 to 7560a3c Compare October 15, 2021 00:11
Comment on lines 101 to 103
if err != nil {
diag.FromErr(err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you are missing a return here? Unless this is intentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh thanks, good catch!

Copy link
Contributor

@crhino crhino left a comment

Choose a reason for hiding this comment

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

LGTM, besides one small question regarding the error case. Thanks for doing this!

to be called within a resource, after learning
that the providerMeta is only available within the
context of a resource, not the provider itself.
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.

3 participants