@@ -120,18 +120,18 @@ func TestAccStreamRSStreamConnection_kafkaOAuthBearer(t *testing.T) {
120
120
CheckDestroy : CheckDestroyStreamConnection ,
121
121
Steps : []resource.TestStep {
122
122
{
123
- Config : dataSourcesConfig + configureKafka (projectID , instanceName , connectionName , getKafkaAuthenticationConfig ("OAUTHBEARER" , "" , "" , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtentions , httpsCaPem ), "localhost:9092,localhost:9092" , "earliest" , "" , false ),
123
+ Config : dataSourcesConfig + configureKafka (projectID , instanceName , connectionName , getKafkaAuthenticationConfig ("OAUTHBEARER" , "" , "" , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtentions , method ), "localhost:9092,localhost:9092" , "earliest" , "" , false ),
124
124
Check : resource .ComposeAggregateTestCheckFunc (
125
- checkKafkaOAuthAttributes (resourceName , instanceName , connectionName , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtentions , httpsCaPem , "localhost:9092,localhost:9092" , "earliest" , networkingTypePublic , false , true ),
126
- checkKafkaOAuthAttributes (dataSourceName , instanceName , connectionName , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtentions , httpsCaPem , "localhost:9092,localhost:9092" , "earliest" , networkingTypePublic , false , false ),
125
+ checkKafkaOAuthAttributes (resourceName , instanceName , connectionName , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtentions , method , "localhost:9092,localhost:9092" , "earliest" , networkingTypePublic , false , true ),
126
+ checkKafkaOAuthAttributes (dataSourceName , instanceName , connectionName , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtentions , method , "localhost:9092,localhost:9092" , "earliest" , networkingTypePublic , false , false ),
127
127
streamConnectionsAttributeChecks (pluralDataSourceName , nil , nil ),
128
128
),
129
129
},
130
130
{
131
- Config : dataSourcesWithPagination + configureKafka (projectID , instanceName , connectionName , getKafkaAuthenticationConfig ("OAUTHBEARER" , "" , "" , tokenEndpointURL , "clientId2" , "clientSecret" , scope , saslOauthbearerExtentions , httpsCaPem ), "localhost:9093" , "latest" , kafkaNetworkingPublic , false ),
131
+ Config : dataSourcesWithPagination + configureKafka (projectID , instanceName , connectionName , getKafkaAuthenticationConfig ("OAUTHBEARER" , "" , "" , tokenEndpointURL , "clientId2" , "clientSecret" , scope , saslOauthbearerExtentions , method ), "localhost:9093" , "latest" , kafkaNetworkingPublic , false ),
132
132
Check : resource .ComposeAggregateTestCheckFunc (
133
- checkKafkaOAuthAttributes (resourceName , instanceName , connectionName , tokenEndpointURL , "clientId2" , "clientSecret" , scope , saslOauthbearerExtentions , httpsCaPem , "localhost:9093" , "latest" , networkingTypePublic , false , true ),
134
- checkKafkaOAuthAttributes (dataSourceName , instanceName , connectionName , tokenEndpointURL , "clientId2" , "clientSecret" , scope , saslOauthbearerExtentions , httpsCaPem , "localhost:9093" , "latest" , networkingTypePublic , false , false ),
133
+ checkKafkaOAuthAttributes (resourceName , instanceName , connectionName , tokenEndpointURL , "clientId2" , "clientSecret" , scope , saslOauthbearerExtentions , method , "localhost:9093" , "latest" , networkingTypePublic , false , true ),
134
+ checkKafkaOAuthAttributes (dataSourceName , instanceName , connectionName , tokenEndpointURL , "clientId2" , "clientSecret" , scope , saslOauthbearerExtentions , method , "localhost:9093" , "latest" , networkingTypePublic , false , false ),
135
135
streamConnectionsAttributeChecks (pluralDataSourceName , conversion .Pointer (2 ), conversion .Pointer (1 )),
136
136
),
137
137
},
@@ -400,7 +400,7 @@ func TestAccStreamRSStreamConnection_AWSLambda(t *testing.T) {
400
400
})
401
401
}
402
402
403
- func getKafkaAuthenticationConfig (mechanism , username , password , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtensions , httpsCaPem string ) string {
403
+ func getKafkaAuthenticationConfig (mechanism , username , password , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtensions , method string ) string {
404
404
if mechanism == "PLAIN" {
405
405
return fmt .Sprintf (`authentication = {
406
406
mechanism = %[1]q
@@ -410,13 +410,13 @@ func getKafkaAuthenticationConfig(mechanism, username, password, tokenEndpointUR
410
410
}
411
411
return fmt .Sprintf (`authentication = {
412
412
mechanism = %[1]q
413
- token_endpoint_url = %[2]q
414
- client_id = %[3]q
415
- client_secret = %[4]q
416
- scope = %[5]q
417
- sasl_oauthbearer_extensions = %[6]q
418
- https_ca_pem = %[7]q
419
- }` , mechanism , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtensions , httpsCaPem )
413
+ method = %[2]q
414
+ token_endpoint_url = %[3]q
415
+ client_id = %[4]q
416
+ client_secret = %[5]q
417
+ scope = %[6]q
418
+ sasl_oauthbearer_extensions = %[7]q
419
+ }` , mechanism , method , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtensions )
420
420
}
421
421
422
422
func configureKafka (projectID , instanceName , connectionName , authenticationConfig , bootstrapServers , configValue , networkingConfig string , useSSL bool ) string {
@@ -519,19 +519,19 @@ func checkKafkaAttributes(
519
519
}
520
520
521
521
func checkKafkaOAuthAttributes (
522
- resourceName , instanceName , connectionName , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtensions , httpsCaPem , bootstrapServers , configValue , networkingType string , usesSSL , checkClientSecret bool ) resource.TestCheckFunc {
522
+ resourceName , instanceName , connectionName , tokenEndpointURL , clientID , clientSecret , scope , saslOauthbearerExtensions , method , bootstrapServers , configValue , networkingType string , usesSSL , checkClientSecret bool ) resource.TestCheckFunc {
523
523
resourceChecks := []resource.TestCheckFunc {
524
524
checkStreamConnectionExists (),
525
525
resource .TestCheckResourceAttrSet (resourceName , "project_id" ),
526
526
resource .TestCheckResourceAttr (resourceName , "connection_name" , connectionName ),
527
527
resource .TestCheckResourceAttr (resourceName , "type" , "Kafka" ),
528
528
resource .TestCheckResourceAttr (resourceName , "instance_name" , instanceName ),
529
529
resource .TestCheckResourceAttr (resourceName , "authentication.mechanism" , "OAUTHBEARER" ),
530
+ resource .TestCheckResourceAttr (resourceName , "authentication.method" , method ),
530
531
resource .TestCheckResourceAttr (resourceName , "authentication.token_endpoint_url" , tokenEndpointURL ),
531
532
resource .TestCheckResourceAttr (resourceName , "authentication.client_id" , clientID ),
532
533
resource .TestCheckResourceAttr (resourceName , "authentication.scope" , scope ),
533
534
resource .TestCheckResourceAttr (resourceName , "authentication.sasl_oauthbearer_extensions" , saslOauthbearerExtensions ),
534
- resource .TestCheckResourceAttr (resourceName , "authentication.https_ca_pem" , httpsCaPem ),
535
535
resource .TestCheckResourceAttr (resourceName , "bootstrap_servers" , bootstrapServers ),
536
536
resource .TestCheckResourceAttr (resourceName , "config.auto.offset.reset" , configValue ),
537
537
}
0 commit comments