diff --git a/internal/clients/confluent.go b/internal/clients/confluent.go index 66ec9ce..a21af0d 100644 --- a/internal/clients/confluent.go +++ b/internal/clients/confluent.go @@ -71,19 +71,21 @@ func TerraformSetupBuilder(version, providerSource, providerVersion string, sche } // Set credentials in Terraform provider configuration. - ps.Configuration = map[string]any{ - cloudAPIKey: creds[cloudAPIKey], - cloudAPISecret: creds[cloudAPISecret], + ps.Configuration = map[string]any{} + if cloudAPIKey, ok := creds[cloudAPIKey]; ok { + ps.Configuration[cloudAPIKey] = creds[cloudAPIKey] + } + if cloudAPISecret, ok := creds[cloudAPISecret]; ok { + ps.Configuration[cloudAPISecret] = creds[cloudAPISecret] } - if kafkaAPIKey, ok := creds[kafkaAPIKey]; ok { - ps.Configuration[kafkaAPIKey] = creds[kafkaAPIKey], + ps.Configuration[kafkaAPIKey] = creds[kafkaAPIKey] } if kafkaAPISecret, ok := creds[kafkaAPISecret]; ok { - ps.Configuration[kafkaAPISecret] = creds[kafkaAPISecret], + ps.Configuration[kafkaAPISecret] = creds[kafkaAPISecret] } if kafkaRESTEndpoint, ok := creds[kafkaRESTEndpoint]; ok { - ps.Configuration[kafkaRESTEndpoint] = creds[kafkaRESTEndpoint], + ps.Configuration[kafkaRESTEndpoint] = creds[kafkaRESTEndpoint] } return ps, nil }