Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orbital resources: bump API version from 2022-03-01 to 2022-11-01 #21405

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/services/orbital/client/client.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package client

import (
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contact"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/groundstation"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/spacecraft"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contact"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/groundstation"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/spacecraft"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/services/orbital/contact_profile_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contactprofile"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate"
Expand Down Expand Up @@ -145,7 +145,7 @@ func (r ContactProfileResource) Create() sdk.ResourceFunc {
Id: utils.String(id.ID()),
Location: model.Location,
Name: utils.String(model.Name),
Properties: &contactProfilesProperties,
Properties: contactProfilesProperties,
Tags: &model.Tags,
}

Expand Down Expand Up @@ -259,7 +259,7 @@ func (r ContactProfileResource) Update() sdk.ResourceFunc {
if metadata.ResourceData.HasChangesExcept("name", "resource_group_name") {
contactProfile := contactprofile.ContactProfile{
Location: state.Location,
Properties: &contactprofile.ContactProfilesProperties{
Properties: contactprofile.ContactProfilesProperties{
AutoTrackingConfiguration: &autoTrackingConfiguration,
EventHubUri: &state.EventHubUri,
Links: contactProfileLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contactprofile"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
36 changes: 23 additions & 13 deletions internal/services/orbital/contact_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"time"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contact"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/spacecraft"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contact"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/spacecraft"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down Expand Up @@ -112,7 +112,7 @@ func (r ContactResource) Create() sdk.ResourceFunc {
}

contactProfile := contact.ResourceReference{
Id: &model.ContactProfileId,
Id: model.ContactProfileId,
}

contactProperties := contact.ContactsProperties{
Expand All @@ -125,7 +125,7 @@ func (r ContactResource) Create() sdk.ResourceFunc {
contact := contact.Contact{
Id: utils.String(id.ID()),
Name: utils.String(model.Name),
Properties: &contactProperties,
Properties: contactProperties,
}
if _, err = client.Create(ctx, id, contact); err != nil {
return fmt.Errorf("creating %s: %+v", id, err)
Expand Down Expand Up @@ -161,18 +161,28 @@ func (r ContactResource) Read() sdk.ResourceFunc {
Name: id.ContactName,
Spacecraft: spacecraftId.ID(),
}

if props != nil {
if props.ReservationStartTime != "" {
state.ReservationStartTime = props.ReservationStartTime
} else {
return fmt.Errorf("contact profile reservation start time is missing %s", *id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this returned as an error? this should be flagged as missing in the diff

}

if props.ReservationEndTime != "" {
state.ReservationEndTime = props.ReservationEndTime
} else {
return fmt.Errorf("contact profile reservation end time is missing %s", *id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this returned as an error? this should be flagged as missing in the diff

}

if props.GroundStationName != "" {
state.GroundStationName = props.GroundStationName
if props.ContactProfile.Id != nil {
state.ContactProfileId = *props.ContactProfile.Id
} else {
return fmt.Errorf("contact profile id is missing %s", *id)
}
} else {
return fmt.Errorf("required properties are missing %s", *id)
return fmt.Errorf("contact profile ground station name is missing %s", *id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this returned as an error? this should be flagged as missing in the diff

}

if props.ContactProfile.Id != "" {
state.ContactProfileId = props.ContactProfile.Id
} else {
return fmt.Errorf("contact profile id is missing %s", *id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this returned as an error? this should be flagged as missing in the diff

}

return metadata.Encode(&state)
Expand Down
2 changes: 1 addition & 1 deletion internal/services/orbital/contact_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contact"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contact"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down
4 changes: 2 additions & 2 deletions internal/services/orbital/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package orbital
import (
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/spacecraft"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/contactprofile"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/spacecraft"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down
34 changes: 17 additions & 17 deletions internal/services/orbital/spacecraft_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/spacecraft"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/spacecraft"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
Expand Down Expand Up @@ -111,18 +111,18 @@ func (r SpacecraftResource) Create() sdk.ResourceFunc {
return fmt.Errorf("expanding `links`: %+v", err)
}
spacecraftProperties := spacecraft.SpacecraftsProperties{
Links: &links,
NoradId: model.NoradId,
TleLine1: &model.TwoLineElements[0],
TleLine2: &model.TwoLineElements[1],
TitleLine: &model.TitleLine,
Links: links,
NoradId: utils.String(model.NoradId),
TleLine1: model.TwoLineElements[0],
TleLine2: model.TwoLineElements[1],
TitleLine: model.TitleLine,
}

spacecraft := spacecraft.Spacecraft{
Id: utils.String(id.ID()),
Location: model.Location,
Name: utils.String(model.Name),
Properties: &spacecraftProperties,
Properties: spacecraftProperties,
Tags: &model.Tags,
}
if err = client.CreateOrUpdateThenPoll(ctx, id, spacecraft); err != nil {
Expand Down Expand Up @@ -154,19 +154,19 @@ func (r SpacecraftResource) Read() sdk.ResourceFunc {

if model := resp.Model; model != nil {
props := model.Properties
twoLineElements := []string{*props.TleLine1, *props.TleLine2}
twoLineElements := []string{props.TleLine1, props.TleLine2}
state := SpacecraftResourceModel{
Name: id.SpacecraftName,
ResourceGroup: id.ResourceGroupName,
Location: model.Location,
NoradId: props.NoradId,
NoradId: *props.NoradId,
TwoLineElements: twoLineElements,
TitleLine: *props.TitleLine,
TitleLine: props.TitleLine,
}
if model.Tags != nil {
state.Tags = *model.Tags
}
spacecraftLinks, err := flattenSpacecraftLinks(*props.Links)
spacecraftLinks, err := flattenSpacecraftLinks(props.Links)
if err != nil {
return err
}
Expand Down Expand Up @@ -227,12 +227,12 @@ func (r SpacecraftResource) Update() sdk.ResourceFunc {
if metadata.ResourceData.HasChangesExcept("name", "resource_group_name") {
spacecraft := spacecraft.Spacecraft{
Location: state.Location,
Properties: &spacecraft.SpacecraftsProperties{
Links: &spacecraftLinks,
NoradId: state.NoradId,
TitleLine: &state.TitleLine,
TleLine1: &state.TwoLineElements[0],
TleLine2: &state.TwoLineElements[1],
Properties: spacecraft.SpacecraftsProperties{
Links: spacecraftLinks,
NoradId: utils.String(state.NoradId),
TitleLine: state.TitleLine,
TleLine1: state.TwoLineElements[0],
TleLine2: state.TwoLineElements[1],
},
Tags: &state.Tags,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/services/orbital/spacecraft_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-03-01/spacecraft"
"github.com/hashicorp/go-azure-sdk/resource-manager/orbital/2022-11-01/spacecraft"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down

This file was deleted.

This file was deleted.

Loading