Skip to content

Commit

Permalink
Disable api key validation to support other keys than Kafka cluster.
Browse files Browse the repository at this point in the history
Also see:
- Mongey#86
- Mongey#89
  • Loading branch information
Ward Loos committed Jun 29, 2021
1 parent a65b712 commit 4940462
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions ccloud/resource_api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"context"
"fmt"
"log"
"time"

ccloud "github.com/cgroschupp/go-client-confluent-cloud/confluentcloud"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down Expand Up @@ -112,20 +110,20 @@ func apiKeyCreate(ctx context.Context, d *schema.ResourceData, meta interface{})
}

log.Printf("[INFO] Created API Key, waiting for it become usable")
stateConf := &resource.StateChangeConf{
Pending: []string{"Pending"},
Target: []string{"Ready"},
Refresh: clusterReady(c, clusterID, accountID, key.Key, key.Secret),
Timeout: 300 * time.Second,
Delay: 10 * time.Second,
PollInterval: 5 * time.Second,
MinTimeout: 20 * time.Second,
}

_, err = stateConf.WaitForStateContext(context.Background())
if err != nil {
return diag.FromErr(fmt.Errorf("Error waiting for API Key (%s) to be ready: %s", d.Id(), err))
}
// stateConf := &resource.StateChangeConf{
// Pending: []string{"Pending"},
// Target: []string{"Ready"},
// Refresh: clusterReady(c, clusterID, accountID, key.Key, key.Secret),
// Timeout: 300 * time.Second,
// Delay: 10 * time.Second,
// PollInterval: 5 * time.Second,
// MinTimeout: 20 * time.Second,
// }

// _, err = stateConf.WaitForStateContext(context.Background())
// if err != nil {
// return diag.FromErr(fmt.Errorf("Error waiting for API Key (%s) to be ready: %s", d.Id(), err))
// }
} else {
log.Printf("[ERROR] Could not create API key: %s", err)
}
Expand Down

0 comments on commit 4940462

Please sign in to comment.