Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kafkatopic): creation simplification #1357

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions internal/sdkprovider/service/kafkatopic/kafka_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,13 @@ func resourceKafkaTopicCreate(ctx context.Context, d *schema.ResourceData, m int
Tags: getTags(d),
}

w := &kafkaTopicCreateWaiter{
Context: ctx,
Client: m.(*aiven.Client),
Project: project,
ServiceName: serviceName,
CreateRequest: createRequest,
}

timeout := d.Timeout(schema.TimeoutCreate)

// nolint:staticcheck // TODO: Migrate to helper/retry package to avoid deprecated WaitForStateContext.
_, err = w.Conf(timeout).WaitForStateContext(ctx)
if err != nil {
err = m.(*aiven.Client).KafkaTopics.Create(
ctx,
project,
serviceName,
createRequest,
)
if err != nil && !aiven.IsAlreadyExists(err) {
return diag.FromErr(err)
}
ivan-savciuc marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ func (t *kafkaTopicCache) GetV1List(projectName, serviceName string) []string {
}

// DeleteTopicFromCache Invalidates cache for the topic
// This function only exists to pass acceptance tests. Cache invalidation
// happens automatically in Terraform when used in the real-life world between
// each subsequent operation. However, during the acceptance test execution,
// we need to mimic the cache invalidation mechanism by calling this function.
func DeleteTopicFromCache(projectName, serviceName, topicName string) {
t := getTopicCache()
t.Lock()
Expand Down
68 changes: 0 additions & 68 deletions internal/sdkprovider/service/kafkatopic/kafka_topic_create.go

This file was deleted.