Skip to content

Commit

Permalink
device_profile_id should not be computed
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Aug 13, 2024
1 parent 7ad9b52 commit ca17f8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 4 additions & 3 deletions apstra/freeform/freeform_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ func (o FreeformSystem) ResourceAttributes() map[string]resourceSchema.Attribute
)},
},
"device_profile_id": resourceSchema.StringAttribute{
MarkdownDescription: "Device profile ID of the System",
Optional: true,
Computed: true,
MarkdownDescription: fmt.Sprintf("Device profile ID of the System. Required when `type` is %q.",
utils.StringersToFriendlyString(apstra.SystemTypeInternal)),
Optional: true,
Validators: []validator.String{
stringvalidator.LengthAtLeast(1),
apstravalidator.ForbiddenWhenValueIs(path.MatchRoot("type"), types.StringValue(utils.StringersToFriendlyString(apstra.SystemTypeExternal))),
apstravalidator.RequiredWhenValueIs(path.MatchRoot("type"), types.StringValue(utils.StringersToFriendlyString(apstra.SystemTypeInternal))),
},
},
"system_id": resourceSchema.StringAttribute{
Expand Down
7 changes: 0 additions & 7 deletions apstra/resource_freeform_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ func (o *resourceFreeformSystem) Create(ctx context.Context, req resource.Create
}

plan.Id = types.StringValue(id.String())
if plan.DeviceProfileId.IsUnknown() {
plan.DeviceProfileId = types.StringNull()
}

// set state
resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...)
Expand Down Expand Up @@ -164,10 +161,6 @@ func (o *resourceFreeformSystem) Update(ctx context.Context, req resource.Update
return
}

if plan.DeviceProfileId.IsUnknown() {
plan.DeviceProfileId = types.StringNull()
}

// set state
resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...)
}
Expand Down

0 comments on commit ca17f8a

Please sign in to comment.