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

Stop editing the global config object with new useragent entries #7576

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4123.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
provider: fixed an issue where the request headers would grow proportionally to the number of resources in a given `terraform apply`
```
11 changes: 0 additions & 11 deletions google/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ func TestAccProviderMeta_setModuleName(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccProviderMeta_setModuleName(moduleName, randString(t, 10)),
Check: testAccCheckConfigAgentModified(t, moduleName),
},
{
ResourceName: "google_compute_address.default",
Expand All @@ -492,16 +491,6 @@ func TestAccProviderMeta_setModuleName(t *testing.T) {
})
}

func testAccCheckConfigAgentModified(t *testing.T, moduleName string) func(s *terraform.State) error {
return func(s *terraform.State) error {
config := googleProviderConfig(t)
if !strings.Contains(config.userAgent, moduleName) {
return fmt.Errorf("expected userAgent to contain provider_meta set module_name")
}
return nil
}
}

func TestAccProviderUserProjectOverride(t *testing.T) {
// Parallel fine-grained resource creation
skipIfVcr(t)
Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_approval_folder_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ func resourceAccessApprovalFolderSettingsUpdate(d *schema.ResourceData, meta int
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -331,7 +330,6 @@ func resourceAccessApprovalFolderSettingsDelete(d *schema.ResourceData, meta int
if err != nil {
return err
}
config.userAgent = userAgent

obj := make(map[string]interface{})
obj["notificationEmails"] = []string{}
Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_approval_organization_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ func resourceAccessApprovalOrganizationSettingsUpdate(d *schema.ResourceData, me
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -293,7 +292,6 @@ func resourceAccessApprovalOrganizationSettingsDelete(d *schema.ResourceData, me
if err != nil {
return err
}
config.userAgent = userAgent

obj := make(map[string]interface{})
obj["notificationEmails"] = []string{}
Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_approval_project_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ func resourceAccessApprovalProjectSettingsUpdate(d *schema.ResourceData, meta in
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -321,7 +320,6 @@ func resourceAccessApprovalProjectSettingsDelete(d *schema.ResourceData, meta in
if err != nil {
return err
}
config.userAgent = userAgent

obj := make(map[string]interface{})
obj["notificationEmails"] = []string{}
Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_context_manager_access_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ func resourceAccessContextManagerAccessLevelUpdate(d *schema.ResourceData, meta
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -527,7 +526,6 @@ func resourceAccessContextManagerAccessLevelDelete(d *schema.ResourceData, meta
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ func resourceAccessContextManagerAccessLevelConditionDelete(d *schema.ResourceDa
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_context_manager_access_levels.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ func resourceAccessContextManagerAccessLevelsUpdate(d *schema.ResourceData, meta
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -432,7 +431,6 @@ func resourceAccessContextManagerAccessLevelsDelete(d *schema.ResourceData, meta
if err != nil {
return err
}
config.userAgent = userAgent

obj := make(map[string]interface{})
obj["accessLevels"] = []string{}
Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_context_manager_access_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ func resourceAccessContextManagerAccessPolicyUpdate(d *schema.ResourceData, meta
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -268,7 +267,6 @@ func resourceAccessContextManagerAccessPolicyDelete(d *schema.ResourceData, meta
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_context_manager_service_perimeter.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ func resourceAccessContextManagerServicePerimeterUpdate(d *schema.ResourceData,
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -577,7 +576,6 @@ func resourceAccessContextManagerServicePerimeterDelete(d *schema.ResourceData,
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ func resourceAccessContextManagerServicePerimeterResourceDelete(d *schema.Resour
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_access_context_manager_service_perimeters.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ func resourceAccessContextManagerServicePerimetersUpdate(d *schema.ResourceData,
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -442,7 +441,6 @@ func resourceAccessContextManagerServicePerimetersDelete(d *schema.ResourceData,
if err != nil {
return err
}
config.userAgent = userAgent

obj := make(map[string]interface{})
obj["servicePerimeters"] = []string{}
Expand Down
2 changes: 0 additions & 2 deletions google/resource_active_directory_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ func resourceActiveDirectoryDomainUpdate(d *schema.ResourceData, meta interface{
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -360,7 +359,6 @@ func resourceActiveDirectoryDomainDelete(d *schema.ResourceData, meta interface{
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_active_directory_domain_trust.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ func resourceActiveDirectoryDomainTrustUpdate(d *schema.ResourceData, meta inter
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -400,7 +399,6 @@ func resourceActiveDirectoryDomainTrustDelete(d *schema.ResourceData, meta inter
if err != nil {
return err
}
config.userAgent = userAgent

project, err := getProject(d, config)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions google/resource_app_engine_application_url_dispatch_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ func resourceAppEngineApplicationUrlDispatchRulesUpdate(d *schema.ResourceData,
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -256,7 +255,6 @@ func resourceAppEngineApplicationUrlDispatchRulesDelete(d *schema.ResourceData,
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_app_engine_domain_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ func resourceAppEngineDomainMappingUpdate(d *schema.ResourceData, meta interface
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -367,7 +366,6 @@ func resourceAppEngineDomainMappingDelete(d *schema.ResourceData, meta interface
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_app_engine_firewall_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ func resourceAppEngineFirewallRuleUpdate(d *schema.ResourceData, meta interface{
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -347,7 +346,6 @@ func resourceAppEngineFirewallRuleDelete(d *schema.ResourceData, meta interface{
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_app_engine_flexible_app_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,6 @@ func resourceAppEngineFlexibleAppVersionUpdate(d *schema.ResourceData, meta inte
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -1389,7 +1388,6 @@ func resourceAppEngineFlexibleAppVersionDelete(d *schema.ResourceData, meta inte
if err != nil {
return err
}
config.userAgent = userAgent

if d.Get("noop_on_destroy") == true {
log.Printf("[DEBUG] Keeping the AppVersion %q", d.Id())
Expand Down
8 changes: 0 additions & 8 deletions google/resource_app_engine_service_split_traffic.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ func resourceAppEngineServiceSplitTrafficUpdate(d *schema.ResourceData, meta int
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -284,13 +283,6 @@ func resourceAppEngineServiceSplitTrafficUpdate(d *schema.ResourceData, meta int
}

func resourceAppEngineServiceSplitTrafficDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
userAgent, err := generateUserAgentString(d, config.userAgent)
if err != nil {
return err
}
config.userAgent = userAgent

log.Printf("[WARNING] AppEngine ServiceSplitTraffic resources"+
" cannot be deleted from GCP. The resource %s will be removed from Terraform"+
" state, but will still be present on the server.", d.Id())
Expand Down
21 changes: 0 additions & 21 deletions google/resource_app_engine_service_split_traffic_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@
package google

import (
"log"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccAppEngineServiceSplitTraffic_appEngineServiceSplitTrafficExample(t *testing.T) {
Expand All @@ -37,7 +34,6 @@ func TestAccAppEngineServiceSplitTraffic_appEngineServiceSplitTrafficExample(t *
ExternalProviders: map[string]resource.ExternalProvider{
"random": {},
},
CheckDestroy: testAccCheckAppEngineServiceSplitTrafficDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccAppEngineServiceSplitTraffic_appEngineServiceSplitTrafficExample(context),
Expand Down Expand Up @@ -116,20 +112,3 @@ resource "google_app_engine_service_split_traffic" "liveapp" {
}
`, context)
}

func testAccCheckAppEngineServiceSplitTrafficDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
for name, rs := range s.RootModule().Resources {
if rs.Type != "google_app_engine_service_split_traffic" {
continue
}
if strings.HasPrefix(name, "data.") {
continue
}

log.Printf("[DEBUG] Ignoring destroy during test")
}

return nil
}
}
2 changes: 0 additions & 2 deletions google/resource_app_engine_standard_app_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ func resourceAppEngineStandardAppVersionUpdate(d *schema.ResourceData, meta inte
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -835,7 +834,6 @@ func resourceAppEngineStandardAppVersionDelete(d *schema.ResourceData, meta inte
if err != nil {
return err
}
config.userAgent = userAgent

if d.Get("noop_on_destroy") == true {
log.Printf("[DEBUG] Keeping the AppVersion %q", d.Id())
Expand Down
2 changes: 0 additions & 2 deletions google/resource_big_query_dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ func resourceBigQueryDatasetUpdate(d *schema.ResourceData, meta interface{}) err
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -590,7 +589,6 @@ func resourceBigQueryDatasetDelete(d *schema.ResourceData, meta interface{}) err
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
1 change: 0 additions & 1 deletion google/resource_big_query_dataset_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ func resourceBigQueryDatasetAccessDelete(d *schema.ResourceData, meta interface{
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
2 changes: 0 additions & 2 deletions google/resource_bigquery_data_transfer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ func resourceBigqueryDataTransferConfigUpdate(d *schema.ResourceData, meta inter
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down Expand Up @@ -486,7 +485,6 @@ func resourceBigqueryDataTransferConfigDelete(d *schema.ResourceData, meta inter
if err != nil {
return err
}
config.userAgent = userAgent

billingProject := ""

Expand Down
Loading