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 user_agent argument to azurerm provider #2393

Closed
richeney opened this issue Nov 27, 2018 · 6 comments · Fixed by #2643
Closed

Add user_agent argument to azurerm provider #2393

richeney opened this issue Nov 27, 2018 · 6 comments · Fixed by #2643
Assignees
Milestone

Comments

@richeney
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add user_agent attribute into the AzureRM provider. If set then append value to the UserAgent header value.

The user_agent value in this context is used for adding a generated pid- to the telemetry. Having an argument in the provider would allow the value to be set within modules, or to set different values dependant on which provider alias is in effect.

New or Affected Resource(s)

Potential Terraform Configuration

provider "azurerm" {
  user_agent = "pid-c8bdea86-f226-11e8-82db-bc838515ccd4"
}

References

The AzureRM provider already appends the value of the AZURE_HTTP_USER_AGENT environment variable to the UserAgent header :

Azure documentation on using GUIDs to attribute customer usage of solutions to the partner's offer and channel:

@tombuildsstuff
Copy link
Member

hey @richeney

Thanks for opening this issue :)

Taking a quick look into this, rather than exposing the user-agent string I think it'd be better to support an optional UUID/GUID for partner_id, which would allow us to validate that this is a UUID/GUID. What do you think?

Thanks!

@richeney
Copy link
Contributor Author

Hi @tombuildsstuff,

You're welcome! I thought it would be a nice distraction from all that 0.12 nonsense. ;)

The value must be in the form pid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or it won't get picked up and attributed to them.

It isn't a partner ID as such - we have the MPN ID for that - and the partners may generated multiple GUIDs to represent the various combinations of offer and channel. The official backend metric name in the Azure health telemetry report is "Publisher Tracking GUID", so perhaps tracking_guid?

@tombuildsstuff
Copy link
Member

@richeney yeah I was thinking we could string format the pid bit to make it easier, such that we'd use fmt.Sprintf("pid-%s", attributionId) - perhaps attribution_id could make more sense?

@richeney
Copy link
Contributor Author

richeney commented Nov 27, 2018

Excuse my basic Go, but how about something close to:

package main

import (
	"fmt"
	"strings"
)

func main() {
	var attribution_id string = "pid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
	var attribution_guid string = strings.TrimPrefix(attribution_id, "pid-")
	attribution_id = fmt.Sprintf("pid-%s", attribution_guid)
	fmt.Println(attribution_id)
}

This way we could check that the attribution_guid has a valid format whilst tolerating the presence of a pid- prefix in the user specified attribution_id argument?

@richeney
Copy link
Contributor Author

Thanks Tom and Jeffrey! 👍

@ghost
Copy link

ghost commented Mar 5, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants