I’m using the terraform plugin framework.
I have acceptance tests for a cluster resource. A cluster can be deployed on AWS/GCP/Azure. Here is part of the terraform object:
type CloudProvider struct {
Cidr types.String `tfsdk:"cidr"`
Region types.String `tfsdk:"region"`
Type types.String `tfsdk:"type"`
}
CIDR is optional in the schema. If the user doesn’t specify a CIDR in the terraform script, the API server will automatically generate one.
The problem is I have multiple cluster acceptance tests running in parallel. In all those tests the terraform script does not set a CIDR. Sometimes the API server will generate the same CIDR for multiple tests. This means the acceptance tests can end up trying to create clusters with duplicate CIDR, which is obviously a problem since CIDR must be unique.
Is it possible to retry a test on specific errors ? Here it would a CIDR conflict error.