Skip to content

Commit

Permalink
optional providerconfig keys (#24)
Browse files Browse the repository at this point in the history
* optional providerconfig keys

Signed-off-by: Jordan Levin <[email protected]>

* optional pc fields

Signed-off-by: Jordan Levin <[email protected]>

---------

Signed-off-by: Jordan Levin <[email protected]>
  • Loading branch information
jaylevin authored Oct 1, 2024
1 parent e0d06c7 commit 35e8c66
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions internal/clients/confluent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 35e8c66

Please sign in to comment.