Skip to content

Commit

Permalink
Fix panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Schuch committed Aug 28, 2023
1 parent e833e5d commit 850ecba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/resources/apiextensions/v1beta1/crd/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ func Read(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagn
d.Set(FieldScope, crd.Spec.Scope)
d.Set(FieldNames, names.Flatten(crd.Spec.Names))

if len(crd.Spec.Versions) > 0 {
d.Set(FieldProperty, property.Flatten(crd.Spec.Versions[0].Schema.OpenAPIV3Schema.Properties))
if len(crd.Spec.Versions) > 0 && crd.Spec.Versions[0].Schema != nil && crd.Spec.Versions[0].Schema.OpenAPIV3Schema != nil {
if crd.Spec.Versions[0].Schema.OpenAPIV3Schema.Properties != nil {
d.Set(FieldProperty, property.Flatten(crd.Spec.Versions[0].Schema.OpenAPIV3Schema.Properties))
}

d.Set(FieldRequired, crd.Spec.Versions[0].Schema.OpenAPIV3Schema.Required)
}

Expand Down

0 comments on commit 850ecba

Please sign in to comment.