From 779be09c12eb885d2d16dcccff1984f76bf5c293 Mon Sep 17 00:00:00 2001 From: JT <100274846+jiaweitao001@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:24:58 +0800 Subject: [PATCH] `azurerm_orbital_spacecraft`, `azurerm_orbital_contact`, `azurerm_orbital_contact_profile`: Deprecate all orbital resources (#28196) * azurerm_orbital_spacecraft, azurerm_orbital_contact, azurerm_orbital_contact_profile: Deprecate all orbital resources * add docs --- .../orbital/contact_profile_resource.go | 6 ++++++ .../orbital/contact_profile_resource_test.go | 16 ++++++++++++++++ internal/services/orbital/contact_resource.go | 6 ++++++ .../services/orbital/contact_resource_test.go | 4 ++++ internal/services/orbital/registration.go | 17 ++++++++++++----- .../services/orbital/spacecraft_resource.go | 6 ++++++ .../orbital/spacecraft_resource_test.go | 10 ++++++++++ website/docs/5.0-upgrade-guide.html.markdown | 12 ++++++++++++ website/docs/r/orbital_contact.html.markdown | 2 ++ .../r/orbital_contact_profile.html.markdown | 2 ++ website/docs/r/orbital_spacecraft.html.markdown | 2 ++ 11 files changed, 78 insertions(+), 5 deletions(-) diff --git a/internal/services/orbital/contact_profile_resource.go b/internal/services/orbital/contact_profile_resource.go index 2e45ca281dc5..9505a99d3c00 100644 --- a/internal/services/orbital/contact_profile_resource.go +++ b/internal/services/orbital/contact_profile_resource.go @@ -25,6 +25,12 @@ type ContactProfileResource struct{} var _ sdk.ResourceWithUpdate = ContactProfileResource{} +var _ sdk.ResourceWithDeprecationAndNoReplacement = ContactProfileResource{} + +func (r ContactProfileResource) DeprecationMessage() string { + return "The `azurerm_orbital_contact_profile` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider." +} + type ContactProfileResourceModel struct { Name string `tfschema:"name"` ResourceGroup string `tfschema:"resource_group_name"` diff --git a/internal/services/orbital/contact_profile_resource_test.go b/internal/services/orbital/contact_profile_resource_test.go index 124d035a1241..57ecaffa492c 100644 --- a/internal/services/orbital/contact_profile_resource_test.go +++ b/internal/services/orbital/contact_profile_resource_test.go @@ -13,6 +13,7 @@ import ( "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" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,6 +21,9 @@ import ( type ContactProfileResource struct{} func TestAccContactProfile_basic(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_contact_profile` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_contact_profile", "test") r := ContactProfileResource{} @@ -35,6 +39,9 @@ func TestAccContactProfile_basic(t *testing.T) { } func TestAccContactProfile_multipleChannels(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_contact_profile` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_contact_profile", "test") r := ContactProfileResource{} @@ -50,6 +57,9 @@ func TestAccContactProfile_multipleChannels(t *testing.T) { } func TestAccContactProfile_addChannel(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_contact_profile` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_contact_profile", "test") r := ContactProfileResource{} @@ -72,6 +82,9 @@ func TestAccContactProfile_addChannel(t *testing.T) { } func TestAccContactProfile_update(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_contact_profile` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_contact_profile", "test") r := ContactProfileResource{} @@ -93,6 +106,9 @@ func TestAccContactProfile_update(t *testing.T) { } func TestAccContactProfile_complete(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_contact_profile` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_contact_profile", "test") r := ContactProfileResource{} diff --git a/internal/services/orbital/contact_resource.go b/internal/services/orbital/contact_resource.go index bb416088ff58..9b589aa6dace 100644 --- a/internal/services/orbital/contact_resource.go +++ b/internal/services/orbital/contact_resource.go @@ -19,6 +19,12 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/utils" ) +var _ sdk.ResourceWithDeprecationAndNoReplacement = ContactResource{} + +func (r ContactResource) DeprecationMessage() string { + return "The `azurerm_orbital_contact` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider." +} + type ContactResource struct{} type ContactResourceModel struct { diff --git a/internal/services/orbital/contact_resource_test.go b/internal/services/orbital/contact_resource_test.go index 066913e631b9..cdc37146a270 100644 --- a/internal/services/orbital/contact_resource_test.go +++ b/internal/services/orbital/contact_resource_test.go @@ -14,6 +14,7 @@ import ( "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" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -21,6 +22,9 @@ import ( type ContactResource struct{} func TestAccContact_basic(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_contact` is deprecated and will be removed in 5.0") + } skipContact(t) data := acceptance.BuildTestData(t, "azurerm_orbital_contact", "test") diff --git a/internal/services/orbital/registration.go b/internal/services/orbital/registration.go index 132f86f81809..276c7491fdb1 100644 --- a/internal/services/orbital/registration.go +++ b/internal/services/orbital/registration.go @@ -3,7 +3,10 @@ package orbital -import "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) type Registration struct{} @@ -26,11 +29,15 @@ func (r Registration) DataSources() []sdk.DataSource { } func (r Registration) Resources() []sdk.Resource { - return []sdk.Resource{ - SpacecraftResource{}, - ContactProfileResource{}, - ContactResource{}, + if !features.FivePointOhBeta() { + return []sdk.Resource{ + SpacecraftResource{}, + ContactProfileResource{}, + ContactResource{}, + } } + + return nil } var _ sdk.TypedServiceRegistration = Registration{} diff --git a/internal/services/orbital/spacecraft_resource.go b/internal/services/orbital/spacecraft_resource.go index 1642812edad3..2fb71e2f3659 100644 --- a/internal/services/orbital/spacecraft_resource.go +++ b/internal/services/orbital/spacecraft_resource.go @@ -23,6 +23,12 @@ type SpacecraftResource struct{} var _ sdk.ResourceWithUpdate = SpacecraftResource{} +var _ sdk.ResourceWithDeprecationAndNoReplacement = SpacecraftResource{} + +func (r SpacecraftResource) DeprecationMessage() string { + return "The `azurerm_orbital_spacecraft` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider." +} + type SpacecraftResourceModel struct { Name string `tfschema:"name"` ResourceGroup string `tfschema:"resource_group_name"` diff --git a/internal/services/orbital/spacecraft_resource_test.go b/internal/services/orbital/spacecraft_resource_test.go index dbffdf1b7ff2..56b10dfddaf3 100644 --- a/internal/services/orbital/spacecraft_resource_test.go +++ b/internal/services/orbital/spacecraft_resource_test.go @@ -13,6 +13,7 @@ import ( "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" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -20,6 +21,9 @@ import ( type SpacecraftResource struct{} func TestAccSpacecraft_basic(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_spacecraft` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_spacecraft", "test") r := SpacecraftResource{} @@ -35,6 +39,9 @@ func TestAccSpacecraft_basic(t *testing.T) { } func TestAccSpacecraft_update(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_spacecraft` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_spacecraft", "test") r := SpacecraftResource{} @@ -56,6 +63,9 @@ func TestAccSpacecraft_update(t *testing.T) { } func TestAccSpacecraft_complete(t *testing.T) { + if features.FivePointOhBeta() { + t.Skipf("Skipping since `azurerm_orbital_spacecraft` is deprecated and will be removed in 5.0") + } data := acceptance.BuildTestData(t, "azurerm_orbital_spacecraft", "test") r := SpacecraftResource{} diff --git a/website/docs/5.0-upgrade-guide.html.markdown b/website/docs/5.0-upgrade-guide.html.markdown index 6f93f6f0d64e..f97bbc624e01 100644 --- a/website/docs/5.0-upgrade-guide.html.markdown +++ b/website/docs/5.0-upgrade-guide.html.markdown @@ -38,6 +38,18 @@ This deprecated resource has been superseded/retired and has been removed from t * This deprecated resource has been removed from the Azure Provider. Please see the [documention for more details](https://learn.microsoft.com/en-us/azure/defender-for-cloud/prepare-deprecation-log-analytics-mma-agent#log-analytics-agent-autoprovisioning-experience---deprecation-plan). +### `azurerm_orbital_spacecraft` + +* This deprecated resource has been retired and has been removed from the Azure Provider. + +### `azurerm_orbital_contact` + +* This deprecated resource has been retired and has been removed from the Azure Provider. + +### `azurerm_orbital_contact_profile` + +* This deprecated resource has been retired and has been removed from the Azure Provider. + ## Removed Data Sources Please follow the format in the example below for adding removed data sources: diff --git a/website/docs/r/orbital_contact.html.markdown b/website/docs/r/orbital_contact.html.markdown index aa40514fcfc7..78c4f88c9ae4 100644 --- a/website/docs/r/orbital_contact.html.markdown +++ b/website/docs/r/orbital_contact.html.markdown @@ -10,6 +10,8 @@ description: |- Manages an orbital contact. +~> **Note:** The `azurerm_orbital_contact` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. + ## Example Usage ```hcl diff --git a/website/docs/r/orbital_contact_profile.html.markdown b/website/docs/r/orbital_contact_profile.html.markdown index 813f0c241473..e8bb54f7069f 100644 --- a/website/docs/r/orbital_contact_profile.html.markdown +++ b/website/docs/r/orbital_contact_profile.html.markdown @@ -10,6 +10,8 @@ description: |- Manages a Contact profile. +~> **Note:** The `azurerm_orbital_contact_profile` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. + ## Example Usage ```hcl diff --git a/website/docs/r/orbital_spacecraft.html.markdown b/website/docs/r/orbital_spacecraft.html.markdown index bf35d06d9a74..5c1ca6806ac9 100644 --- a/website/docs/r/orbital_spacecraft.html.markdown +++ b/website/docs/r/orbital_spacecraft.html.markdown @@ -10,6 +10,8 @@ description: |- Manages a Spacecraft. +~> **Note:** The `azurerm_orbital_spacecraft` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. + ## Example Usage ```hcl