Skip to content

Commit

Permalink
Merge pull request #954 from Juniper/953-apstra_freeform_resource-val…
Browse files Browse the repository at this point in the history
…idation-must-stop-when-it-encounters-unknown-values

`apstra_freeform_resource` validator should return when values-to-be-validated are not yet known
  • Loading branch information
chrismarget-j authored Oct 25, 2024
2 parents 1b8b2c9 + dadaedc commit 2b696be
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apstra/resource_freeform_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ func (o *resourceFreeformResource) ValidateConfig(ctx context.Context, req resou
return
}

// cannot proceed with unknown values
if config.Type.IsUnknown() ||
config.AllocatedFrom.IsUnknown() ||
config.IntValue.IsUnknown() ||
config.Ipv4Value.IsUnknown() ||
config.Ipv6Value.IsUnknown() {
return
}

var resourceType enum.FFResourceType
err := utils.ApiStringerFromFriendlyString(&resourceType, config.Type.ValueString())
if err != nil {
Expand Down

0 comments on commit 2b696be

Please sign in to comment.