Skip to content

use Provider.UserAgent to generate the user agent header#552

Draft
jedelson-pagerduty wants to merge 1 commit intoPagerDuty:masterfrom
jedelson-pagerduty:issue/better-user-agent
Draft

use Provider.UserAgent to generate the user agent header#552
jedelson-pagerduty wants to merge 1 commit intoPagerDuty:masterfrom
jedelson-pagerduty:issue/better-user-agent

Conversation

@jedelson-pagerduty
Copy link
Contributor

@jedelson-pagerduty jedelson-pagerduty commented Jul 28, 2022

also updating goreleaser configuration to capture version and commit in a way that is easily accessible by the provider configure code

Depends upon heimweh/go-pagerduty#97 (and updating the vendor copy here), so setting this to draft until that is merged.

@jedelson-pagerduty jedelson-pagerduty marked this pull request as draft July 28, 2022 14:55
@jedelson-pagerduty jedelson-pagerduty force-pushed the issue/better-user-agent branch from 79b9fea to ea2afe1 Compare July 28, 2022 15:18
also updating goreleaser configuration to capture version and commit in a way that is easily accessible by the provider configure code
@jedelson-pagerduty jedelson-pagerduty force-pushed the issue/better-user-agent branch from ea2afe1 to 53dbfa4 Compare July 28, 2022 15:20
}

p.ConfigureFunc = func(d *schema.ResourceData) (interface{}, error) {
terraformVersion := p.TerraformVersion
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that the only thing that was happening in ConfigureFunc was normalizing the Terraform version. That should not be necessary when using Provider.UserAgent so I just moved the body of providerConfigure here. I didn't see a reason to have a separate function.

- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.version={{.Version}} -X github.com/terraform-providers/terraform-provider-pagerduty/pagerduty.commit={{.Commit}}'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

main.version and main.commit could be removed here -- those variables don't exist so the current (before this change) configuration is kind of a no-op.

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.

1 participant