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 module_name provider metadata #255

Merged
merged 4 commits into from
Nov 22, 2022
Merged

Conversation

displague
Copy link
Member

Fixes #252

Env TF_APPEND_USER_AGENT is also available.

Signed-off-by: Marques Johansson <mjohansson@equinix.com>
@displague displague marked this pull request as ready for review September 29, 2022 23:35
Copy link
Member Author

@displague displague left a comment

Choose a reason for hiding this comment

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

In some cases the module_name is being repeated in the User-Agent. I initially thought this would happen when Create and Update call Read, but:

With the following patch:

diff --git a/equinix/resource_metal_project.go b/equinix/resource_metal_project.go
index f546e2c4..9b6e0eee 100644
--- a/equinix/resource_metal_project.go
+++ b/equinix/resource_metal_project.go
@@ -176,7 +176,7 @@ func resourceMetalProjectRead(d *schema.ResourceData, meta interface{}) error {
 		return err
 	}
 	client.UserAgent = userAgent
-
+	fmt.Println("look here !!!!!!!!!!!!!", client.UserAgent)
 	proj, _, err := client.Projects.Get(d.Id(), nil)
 	if err != nil {
 		err = friendlyError(err)
diff --git a/equinix/resource_metal_project_acc_test.go b/equinix/resource_metal_project_acc_test.go
index ebae59cf..040d4e96 100644
--- a/equinix/resource_metal_project_acc_test.go
+++ b/equinix/resource_metal_project_acc_test.go
@@ -391,6 +391,11 @@ resource "equinix_metal_project" "foobar" {
 
 func testAccMetalProjectConfig_basic(r int) string {
 	return fmt.Sprintf(`
+	terraform {
+		provider_meta "equinix" {
+			module_name = "test"
+		}
+	}
 resource "equinix_metal_project" "foobar" {
     name = "tfacc-project-%d"
 }`, r)

I see the following:

=== CONT  TestAccMetalProject_importBasic
2022/09/29 20:10:54 [DEBUG] POST https://api.equinix.com/metal/v1/projects
look here !!!!!!!!!!!!! test test HashiCorp Terraform/1.3.0 (+https://www.terraform.io) Terraform Plugin SDK/2.9.0 terraform-provider-equinix/dev packngo/(devel)
2022/09/29 20:10:55 [DEBUG] GET https://api.equinix.com/metal/v1/projects/{id}

@ocobles ocobles added this to the v1.11.0 milestone Nov 7, 2022
@ocobles ocobles merged commit eae28ce into equinix:master Nov 22, 2022
@displague displague deleted the ua_module_name branch December 1, 2022 13:52
thogarty pushed a commit that referenced this pull request Sep 5, 2023
add module_name provider metadata
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.

UA Prefix
3 participants