From ebb1145332e985485b866da48d91e1a6397a5366 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Sat, 1 Mar 2025 21:11:56 +0100 Subject: [PATCH 1/2] Do not use MustString in auth interpolation warning --- .../validate/interpolation_in_auth_config.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bundle/config/validate/interpolation_in_auth_config.go b/bundle/config/validate/interpolation_in_auth_config.go index 83d6c6ae14..bda4378d4b 100644 --- a/bundle/config/validate/interpolation_in_auth_config.go +++ b/bundle/config/validate/interpolation_in_auth_config.go @@ -24,7 +24,10 @@ func (f *noInterpolationInAuthConfig) Name() string { func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics { authFields := []string{ // Generic attributes. - "host", "profile", "auth_type", "metadata_service_url", + "host", + "profile", + "auth_type", + "metadata_service_url", // OAuth specific attributes. "client_id", @@ -33,8 +36,12 @@ func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundl "google_service_account", // Azure specific attributes. - "azure_resource_id", "azure_use_msi", "azure_client_id", "azure_tenant_id", - "azure_environment", "azure_login_app_id", + "azure_resource_id", + "azure_use_msi", + "azure_client_id", + "azure_tenant_id", + "azure_environment", + "azure_login_app_id", } diags := diag.Diagnostics{} @@ -53,7 +60,10 @@ func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundl continue } - vv := v.MustString() + vv, ok := v.AsString() + if !ok { + continue + } // Check if the field contains interpolation. if dynvar.ContainsVariableReference(vv) { From c55c473dd563bcf9e18bc4a5f6a7c63a6e8c5a0c Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 3 Mar 2025 10:44:11 +0100 Subject: [PATCH 2/2] address comments --- bundle/config/validate/interpolation_in_auth_config.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bundle/config/validate/interpolation_in_auth_config.go b/bundle/config/validate/interpolation_in_auth_config.go index bda4378d4b..1a5b64a268 100644 --- a/bundle/config/validate/interpolation_in_auth_config.go +++ b/bundle/config/validate/interpolation_in_auth_config.go @@ -56,10 +56,6 @@ func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundl return diag.FromErr(err) } - if v.Kind() == dyn.KindInvalid || v.Kind() == dyn.KindNil { - continue - } - vv, ok := v.AsString() if !ok { continue