diff --git a/internal/services/web/app_service_environment_data_source.go b/internal/services/web/app_service_environment_data_source.go index b19efd01c2ec..e6be091a6586 100644 --- a/internal/services/web/app_service_environment_data_source.go +++ b/internal/services/web/app_service_environment_data_source.go @@ -19,8 +19,8 @@ import ( func dataSourceAppServiceEnvironment() *pluginsdk.Resource { return &pluginsdk.Resource{ - Read: dataSourceAppServiceEnvironmentRead, - + Read: dataSourceAppServiceEnvironmentRead, + DeprecationMessage: "This data source is deprecated due to the [retirement of v1 and v2 App Service Environments](https://azure.microsoft.com/en-gb/updates/app-service-environment-v1-and-v2-retirement-announcement/) and will be removed inv4.0 of the provider. Please use `azurerm_app_service_environment_v3` instead.", Timeouts: &pluginsdk.ResourceTimeout{ Read: pluginsdk.DefaultTimeout(5 * time.Minute), }, diff --git a/internal/services/web/app_service_environment_data_source_test.go b/internal/services/web/app_service_environment_data_source_test.go index 50672093cbf5..d944b733dffd 100644 --- a/internal/services/web/app_service_environment_data_source_test.go +++ b/internal/services/web/app_service_environment_data_source_test.go @@ -9,11 +9,15 @@ 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/features" ) type AppServiceEnvironmentDataSource struct{} func TestAccDataSourceAppServiceEnvironment_basic(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "data.azurerm_app_service_environment", "test") data.DataSourceTest(t, []acceptance.TestStep{ diff --git a/internal/services/web/app_service_environment_resource.go b/internal/services/web/app_service_environment_resource.go index ae63c40bbc1b..cfdbc2198e5b 100644 --- a/internal/services/web/app_service_environment_resource.go +++ b/internal/services/web/app_service_environment_resource.go @@ -35,10 +35,11 @@ const ( func resourceAppServiceEnvironment() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceAppServiceEnvironmentCreate, - Read: resourceAppServiceEnvironmentRead, - Update: resourceAppServiceEnvironmentUpdate, - Delete: resourceAppServiceEnvironmentDelete, + DeprecationMessage: "This resource is deprecated due to the [retirement of v1 and v2 App Service Environments](https://azure.microsoft.com/en-gb/updates/app-service-environment-v1-and-v2-retirement-announcement/) and will be removed inv4.0 of the provider. Please use `azurerm_app_service_environment_v3` instead.", + Create: resourceAppServiceEnvironmentCreate, + Read: resourceAppServiceEnvironmentRead, + Update: resourceAppServiceEnvironmentUpdate, + Delete: resourceAppServiceEnvironmentDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.AppServiceEnvironmentID(id) return err diff --git a/internal/services/web/app_service_environment_resource_test.go b/internal/services/web/app_service_environment_resource_test.go index 7d17e1d4502f..80b6cb2838ed 100644 --- a/internal/services/web/app_service_environment_resource_test.go +++ b/internal/services/web/app_service_environment_resource_test.go @@ -11,6 +11,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/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -19,6 +20,9 @@ import ( type AppServiceEnvironmentResource struct{} func TestAccAppServiceEnvironment_basic(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} @@ -36,6 +40,9 @@ func TestAccAppServiceEnvironment_basic(t *testing.T) { } func TestAccAppServiceEnvironment_requiresImport(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} @@ -51,6 +58,9 @@ func TestAccAppServiceEnvironment_requiresImport(t *testing.T) { } func TestAccAppServiceEnvironment_update(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} @@ -76,6 +86,9 @@ func TestAccAppServiceEnvironment_update(t *testing.T) { } func TestAccAppServiceEnvironment_tierAndScaleFactor(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} @@ -93,6 +106,9 @@ func TestAccAppServiceEnvironment_tierAndScaleFactor(t *testing.T) { } func TestAccAppServiceEnvironment_withAppServicePlan(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") aspData := acceptance.BuildTestData(t, "azurerm_app_service_plan", "test") r := AppServiceEnvironmentResource{} @@ -112,6 +128,9 @@ func TestAccAppServiceEnvironment_withAppServicePlan(t *testing.T) { } func TestAccAppServiceEnvironment_dedicatedResourceGroup(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} @@ -127,6 +146,9 @@ func TestAccAppServiceEnvironment_dedicatedResourceGroup(t *testing.T) { } func TestAccAppServiceEnvironment_withCertificatePfx(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} @@ -142,6 +164,9 @@ func TestAccAppServiceEnvironment_withCertificatePfx(t *testing.T) { } func TestAccAppServiceEnvironment_internalLoadBalancer(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} @@ -158,6 +183,9 @@ func TestAccAppServiceEnvironment_internalLoadBalancer(t *testing.T) { } func TestAccAppServiceEnvironment_clusterSettings(t *testing.T) { + if features.FourPointOhBeta() { + t.Skip("skipping as removed in 4.0") + } data := acceptance.BuildTestData(t, "azurerm_app_service_environment", "test") r := AppServiceEnvironmentResource{} diff --git a/internal/services/web/registration.go b/internal/services/web/registration.go index 74cce64710eb..76a824990a67 100644 --- a/internal/services/web/registration.go +++ b/internal/services/web/registration.go @@ -4,6 +4,7 @@ package web import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -24,26 +25,28 @@ func (r Registration) WebsiteCategories() []string { // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { - return map[string]*pluginsdk.Resource{ + datasources := map[string]*pluginsdk.Resource{ "azurerm_app_service": dataSourceAppService(), "azurerm_app_service_certificate_order": dataSourceAppServiceCertificateOrder(), - "azurerm_app_service_environment": dataSourceAppServiceEnvironment(), "azurerm_app_service_certificate": dataSourceAppServiceCertificate(), "azurerm_app_service_plan": dataSourceAppServicePlan(), "azurerm_function_app": dataSourceFunctionApp(), "azurerm_function_app_host_keys": dataSourceFunctionAppHostKeys(), } + if !features.FourPointOhBeta() { + datasources["azurerm_app_service_environment"] = dataSourceAppServiceEnvironment() + } + return datasources } // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { - return map[string]*pluginsdk.Resource{ + resources := map[string]*pluginsdk.Resource{ "azurerm_app_service_active_slot": resourceAppServiceActiveSlot(), "azurerm_app_service_certificate": resourceAppServiceCertificate(), "azurerm_app_service_certificate_order": resourceAppServiceCertificateOrder(), "azurerm_app_service_custom_hostname_binding": resourceAppServiceCustomHostnameBinding(), "azurerm_app_service_certificate_binding": resourceAppServiceCertificateBinding(), - "azurerm_app_service_environment": resourceAppServiceEnvironment(), "azurerm_app_service_hybrid_connection": resourceAppServiceHybridConnection(), "azurerm_app_service_managed_certificate": resourceAppServiceManagedCertificate(), "azurerm_app_service_plan": resourceAppServicePlan(), @@ -59,6 +62,12 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_static_site": resourceStaticSite(), "azurerm_static_site_custom_domain": resourceStaticSiteCustomDomain(), } + + if !features.FourPointOhBeta() { + resources["azurerm_app_service_environment"] = resourceAppServiceEnvironment() + } + + return resources } func (r Registration) DataSources() []sdk.DataSource {