diff --git a/internal/clients/confluent.go b/internal/clients/confluent.go index 7ed160a..a21af0d 100644 --- a/internal/clients/confluent.go +++ b/internal/clients/confluent.go @@ -71,12 +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], - kafkaAPIKey: creds[kafkaAPIKey], - kafkaAPISecret: creds[kafkaAPISecret], - kafkaRESTEndpoint: creds[kafkaRESTEndpoint], + 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] + } + if kafkaAPISecret, ok := creds[kafkaAPISecret]; ok { + ps.Configuration[kafkaAPISecret] = creds[kafkaAPISecret] + } + if kafkaRESTEndpoint, ok := creds[kafkaRESTEndpoint]; ok { + ps.Configuration[kafkaRESTEndpoint] = creds[kafkaRESTEndpoint] } return ps, nil }