STACKITLB-1837 | add ALB certificates to provider#1296
STACKITLB-1837 | add ALB certificates to provider#1296david-mey-STACKIT wants to merge 18 commits intostackitcloud:mainfrom
Conversation
Co-authored-by: Marcel Jacek <72880145+marceljk@users.noreply.github.com>
289b525 to
f74a895
Compare
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
stackit/internal/services/albcertificates/certificate/datasource.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate/datasource.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate/datasource.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate/resource.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate_acc_test.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/testfiles/resource-min.tf
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/testfiles/resource-max.tf
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate_acc_test.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate/datasource.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate/resource.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate_acc_test.go
Outdated
Show resolved
Hide resolved
stackit/internal/services/albcertificates/certificate_acc_test.go
Outdated
Show resolved
Hide resolved
| // Avoid race condition: k8s API needs a bit to actually delete the secret | ||
| time.Sleep(300 * time.Millisecond) | ||
|
|
||
| certificateResp, err = client.DefaultAPI.ListCertificates(ctx, testutil.ProjectId, region).Execute() | ||
| if err != nil { | ||
| return fmt.Errorf("getting certificateResp after destroy: %w", err) | ||
| } | ||
| for i := range certificateResp.Items { | ||
| if utils.Contains(certificatesToDestroy, *certificateResp.Items[i].Id) { | ||
| return fmt.Errorf("certificate %s has not been destroyed", *certificateResp.Items[i].Id) | ||
| } | ||
| } | ||
| return nil |
There was a problem hiding this comment.
When I run the acc tests, it fails here that some certificates has not been destroyed. When I increase the time.Sleep it works.
But actually in the current function the delete should only be triggered in case some certificates still exists. The Terraform Testing framework calls at the end the Delete method of the resource.
When the method was successful executed, it calls the testAccCheckCertDestroy() function, which only checks if the deletion works as expected and no resources are pending. So when testAccCheckCertDestroy() is called, the certificates should be already deleted.
To fix this, the delete method of the resource should wait until the deletion was successful, the certificate is really removed.
Description
STACKITLB-1837
Add ALB TLS certificates provider (API: https://docs.api.stackit.cloud/documentation/certificates/version/v2)
Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)