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

r/devspace_controller: disabling the tests & highlighting this'll be removed in 3.0 #10049

Merged
merged 4 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var services = mapOf(
"databasemigration" to "Database Migration",
"desktopvirtualization" to "Desktop Virtualization",
"devtestlabs" to "Dev Test",
"devspace" to "DevSpaces",
"digitaltwins" to "Digital Twins",
"eventgrid" to "EventGrid",
"eventhub" to "EventHub",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func resourceDevSpaceController() *schema.Resource {
return err
}),

DeprecationMessage: `DevSpace Controllers are deprecated and will be retired on 31 October 2023 - at this time the Azure API does not allow new Controllers to be provisioned, but existing DevSpace Controllers can continue to be used.

Since these are deprecated and can no longer be provisioned, version 3.0 of the Azure Provider will remove support for DevSpace Controllers.`,

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

// temporarily works around the unused test, since the tests are skipped
var _ interface{} = DevSpaceControllerResource{}
var _ interface{} = DevSpaceControllerResource{}.basic(acceptance.TestData{}, "", "")
var _ interface{} = DevSpaceControllerResource{}.requiresImport(acceptance.TestData{}, "", "")

type DevSpaceControllerResource struct {
}

func TestAccDevSpaceController_basic(t *testing.T) {
t.Skip("A breaking API change has means new DevSpace Controllers cannot be provisioned, so skipping..")

data := acceptance.BuildTestData(t, "azurerm_devspace_controller", "test")
r := DevSpaceControllerResource{}
clientId := os.Getenv("ARM_CLIENT_ID")
Expand All @@ -36,6 +43,8 @@ func TestAccDevSpaceController_basic(t *testing.T) {
}

func TestAccDevSpaceController_requiresImport(t *testing.T) {
t.Skip("A breaking API change has means new DevSpace Controllers cannot be provisioned, so skipping..")

data := acceptance.BuildTestData(t, "azurerm_devspace_controller", "test")
r := DevSpaceControllerResource{}
clientId := os.Getenv("ARM_CLIENT_ID")
Expand Down
6 changes: 6 additions & 0 deletions azurerm/internal/services/devspace/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package devspace

import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
)

// TODO: this can be moved into Container
Expand All @@ -27,6 +28,11 @@ func (r Registration) SupportedDataSources() map[string]*schema.Resource {

// SupportedResources returns the supported Resources supported by this Service
func (r Registration) SupportedResources() map[string]*schema.Resource {
if features.ThreePointOh() {
return map[string]*schema.Resource{}
}

// TODO: remove this entire package in 3.0
return map[string]*schema.Resource{
"azurerm_devspace_controller": resourceDevSpaceController(),
}
Expand Down
18 changes: 14 additions & 4 deletions azurerm/internal/tools/generator-services/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/provider"
)

// Packages in this list are deprecated and cannot be run due to breaking API changes
// this should only be used as a last resort - since all acctests should run nightly.
var packagesToSkip = map[string]struct{}{
"devspace": {},
}

func main() {
filePath := flag.String("path", "", "The relative path to the root directory")
showHelp := flag.Bool("help", false, "Display this message")
Expand All @@ -29,15 +35,15 @@ func main() {
}
for _, value := range generators {
outputFile := value.outputPath(*filePath)
if err := value.run(outputFile); err != nil {
if err := value.run(outputFile, packagesToSkip); err != nil {
panic(err)
}
}
}

type generator interface {
outputPath(rootDirectory string) string
run(outputFileName string) error
run(outputFileName string, packagesToSkip map[string]struct{}) error
}

type teamCityServicesListGenerator struct{}
Expand All @@ -46,7 +52,7 @@ func (teamCityServicesListGenerator) outputPath(rootDirectory string) string {
return fmt.Sprintf("%s/.teamcity/components/generated/services.kt", rootDirectory)
}

func (teamCityServicesListGenerator) run(outputFileName string) error {
func (teamCityServicesListGenerator) run(outputFileName string, packagesToSkip map[string]struct{}) error {
template := `// NOTE: this is Generated from the Service Definitions - manual changes will be lost
// to re-generate this file, run 'make generate' in the root of the repository
var services = mapOf(
Expand Down Expand Up @@ -91,6 +97,10 @@ var services = mapOf(
sort.Strings(serviceNames)
for _, serviceName := range serviceNames {
packageName := services[serviceName]
if _, shouldSkip := packagesToSkip[packageName]; shouldSkip {
continue
}

item := fmt.Sprintf(" %q to %q", packageName, serviceName)
items = append(items, item)
}
Expand All @@ -105,7 +115,7 @@ func (websiteCategoriesGenerator) outputPath(rootDirectory string) string {
return fmt.Sprintf("%s/website/allowed-subcategories", rootDirectory)
}

func (websiteCategoriesGenerator) run(outputFileName string) error {
func (websiteCategoriesGenerator) run(outputFileName string, _ map[string]struct{}) error {
websiteCategories := make([]string, 0)

// get a distinct list
Expand Down
6 changes: 4 additions & 2 deletions website/docs/r/devspace_controller.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Manages a DevSpace Controller.

~> **NOTE:** Microsoft will be retiring Azure Dev Spaces on 31 October 2023, please see the product [documentation](https://azure.microsoft.com/en-us/updates/azure-dev-spaces-is-retiring-on-31-october-2023/) for more information.

!> **NOTE:** The Azure API no longer allows provisioning new DevSpace Controllers - as such this resource exists only to allow existing users to continue managing these in Terraform at this time. Support for the `azurerm_devspace_controller` resource will be removed in version 3.0 of the Azure Provider.

## Example Usage

```hcl
Expand Down Expand Up @@ -57,6 +59,8 @@ resource "azurerm_devspace_controller" "example" {

## Argument Reference

!> **NOTE:** The Azure API no longer allows provisioning new DevSpace Controllers - as such this resource exists only to allow existing users to continue managing these in Terraform at this time. Support for the `azurerm_devspace_controller` resource will be removed in version 3.0 of the Azure Provider.

The following arguments are supported:

* `name` - (Required) Specifies the name of the DevSpace Controller. Changing this forces a new resource to be created.
Expand Down Expand Up @@ -86,8 +90,6 @@ The following attributes are exported:

## Timeouts



The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions:

* `create` - (Defaults to 30 minutes) Used when creating the DevSpace Controller.
Expand Down