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

fixed permadiffs on environment_variables in cloudfunctions2 function #2488

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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/hcl/v2 v2.19.1
github.com/hashicorp/terraform-json v0.21.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240703160327-4796d59dbd07
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240703190950-3fbe86489a97
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ github.com/hashicorp/terraform-plugin-mux v0.15.0 h1:+/+lDx0WUsIOpkAmdwBIoFU8UP9
github.com/hashicorp/terraform-plugin-mux v0.15.0/go.mod h1:9ezplb1Dyq394zQ+ldB0nvy/qbNAz3mMoHHseMTMaKo=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240703160327-4796d59dbd07 h1:KEK+ri5uJRlBdfB1L0/GtcCG1Yf3UZPqcBMHLNvzfr8=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240703160327-4796d59dbd07/go.mod h1:LtqLd41zCL9zNzjz4lld4q9wnK3+MWRvIdoNc/anTZ0=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240703190950-3fbe86489a97 h1:7M88rwo3WtGy4aaAODa4i0XVWqpcxcDtEj4AeLvgEB0=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240703190950-3fbe86489a97/go.mod h1:LtqLd41zCL9zNzjz4lld4q9wnK3+MWRvIdoNc/anTZ0=
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cloudfunctions2

import (
"reflect"
"strings"

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

Expand All @@ -24,6 +25,21 @@ import (
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
)

// Suppress diffs for the system environment variables
func environmentVariablesDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
if k == "service_config.0.environment_variables.LOG_EXECUTION_ID" && new == "" {
return true
}

// Let diff be determined by environment_variables (above)
if strings.HasPrefix(k, "service_config.0.environment_variables.%") {
return true
}

// For other keys, don't suppress diff.
return false
}

const Cloudfunctions2functionAssetType string = "cloudfunctions.googleapis.com/function"

func ResourceConverterCloudfunctions2function() cai.ResourceConverter {
Expand Down