Skip to content

Commit

Permalink
Merge pull request #15800 from hashicorp/f/3.0
Browse files Browse the repository at this point in the history
provider: enabling 3.0 mode
  • Loading branch information
tombuildsstuff authored Mar 18, 2022
2 parents c74b833 + 1123684 commit dd38de2
Show file tree
Hide file tree
Showing 78 changed files with 8 additions and 14,533 deletions.
6 changes: 0 additions & 6 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
dataprotection "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client"
datashare "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/client"
desktopvirtualization "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/client"
devspace "github.com/hashicorp/terraform-provider-azurerm/internal/services/devspace/client"
devtestlabs "github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/client"
digitaltwins "github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/client"
disks "github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/client"
Expand Down Expand Up @@ -97,7 +96,6 @@ import (
serviceBus "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/client"
serviceFabric "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/client"
serviceFabricManaged "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client"
serviceFabricMesh "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmesh/client"
signalr "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client"
appPlatform "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/client"
sql "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/client"
Expand Down Expand Up @@ -151,7 +149,6 @@ type Client struct {
DataProtection *dataprotection.Client
DataShare *datashare.Client
DesktopVirtualization *desktopvirtualization.Client
DevSpace *devspace.Client
DevTestLabs *devtestlabs.Client
DigitalTwins *digitaltwins.Client
Disks *disks.Client
Expand Down Expand Up @@ -208,7 +205,6 @@ type Client struct {
Sentinel *sentinel.Client
ServiceBus *serviceBus.Client
ServiceFabric *serviceFabric.Client
ServiceFabricMesh *serviceFabricMesh.Client
ServiceFabricManaged *serviceFabricManaged.Client
SignalR *signalr.Client
Storage *storage.Client
Expand Down Expand Up @@ -265,7 +261,6 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.DataProtection = dataprotection.NewClient(o)
client.DataShare = datashare.NewClient(o)
client.DesktopVirtualization = desktopvirtualization.NewClient(o)
client.DevSpace = devspace.NewClient(o)
client.DevTestLabs = devtestlabs.NewClient(o)
client.DigitalTwins = digitaltwins.NewClient(o)
client.Disks = disks.NewClient(o)
Expand Down Expand Up @@ -323,7 +318,6 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
client.ServiceBus = serviceBus.NewClient(o)
client.ServiceFabric = serviceFabric.NewClient(o)
client.ServiceFabricManaged = serviceFabricManaged.NewClient(o)
client.ServiceFabricMesh = serviceFabricMesh.NewClient(o)
client.SignalR = signalr.NewClient(o)
client.Sql = sql.NewClient(o)
client.Storage = storage.NewClient(o)
Expand Down
4 changes: 2 additions & 2 deletions internal/common/client_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func setUserAgent(client *autorest.Client, tfVersion, partnerID string, disableT
tfUserAgent := fmt.Sprintf("HashiCorp Terraform/%s (+https://www.terraform.io) Terraform Plugin SDK/%s", tfVersion, meta.SDKVersionString())

providerUserAgent := fmt.Sprintf("%s terraform-provider-azurerm/%s", tfUserAgent, version.ProviderVersion)
if features.ThreePointOhBeta() {
providerUserAgent = fmt.Sprintf("%s terraform-provider-azurerm/%s+3.0-beta", tfUserAgent, version.ProviderVersion)
if features.FourPointOhBeta() {
providerUserAgent = fmt.Sprintf("%s terraform-provider-azurerm/%s+4.0-beta", tfUserAgent, version.ProviderVersion)
}
client.UserAgent = strings.TrimSpace(fmt.Sprintf("%s %s", client.UserAgent, providerUserAgent))

Expand Down
10 changes: 0 additions & 10 deletions internal/features/kubernetes_config_sensitivity.go

This file was deleted.

34 changes: 3 additions & 31 deletions internal/features/three_point_oh.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package features

import (
"os"
"strings"
)

// nolint gocritic
// DeprecatedInThreePointOh returns the deprecation message if the provider
// is running in 3.0 mode - otherwise is returns an empty string (such that
Expand All @@ -13,40 +8,17 @@ import (
// This will be used to signify resources which will be Deprecated in 3.0,
// but not Removed (which will happen in a later, presumably 4.x release).
func DeprecatedInThreePointOh(deprecationMessage string) string {
if !ThreePointOhBeta() {
return ""
}

return deprecationMessage
}

// ThreePointOh returns whether this provider is running in 3.0 mode
// that is to say - the final 3.0 release
//
// This exists to allow breaking changes to be piped through the provider
// during the development of 2.x until 3.0 is ready.
func ThreePointOh() bool {
return false
return true
}

// ThreePointOhBeta returns whether this provider is running in 3.0 mode
// which is an opt-in Beta of the (non-breaking changes) coming in 3.0.
//
// Any features behind this flag should be backwards-compatible to allow
// users to try out 3.0 functionality.
//
// This flag can be controlled by setting the Environment Variable
// `ARM_THREEPOINTZERO_BETA` to `true`.
// or an opt-in Beta of the (non-breaking changes) coming in 3.0.
func ThreePointOhBeta() bool {
return ThreePointOh() || strings.EqualFold(os.Getenv("ARM_THREEPOINTZERO_BETA"), "true")
}

// ThreePointOhAppServiceResources returns whether this provider is opted into
// the Beta Resources coming in v3.0 - or explicitly opted into v3.0.
func ThreePointOhAppServiceResources() bool {
if ThreePointOh() || ThreePointOhBeta() {
return true
}

return strings.EqualFold(os.Getenv("ARM_THREEPOINTZERO_BETA_RESOURCES"), "true")
return true
}
8 changes: 0 additions & 8 deletions internal/provider/services.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package provider

import (
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/advisor"
Expand Down Expand Up @@ -36,7 +35,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/devspace"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/disks"
Expand Down Expand Up @@ -94,7 +92,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmesh"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/sql"
Expand Down Expand Up @@ -223,7 +220,6 @@ func SupportedUntypedServices() []sdk.UntypedServiceRegistration {
sentinel.Registration{},
servicebus.Registration{},
servicefabric.Registration{},
servicefabricmesh.Registration{},
signalr.Registration{},
sql.Registration{},
storage.Registration{},
Expand All @@ -236,10 +232,6 @@ func SupportedUntypedServices() []sdk.UntypedServiceRegistration {
vmware.Registration{},
web.Registration{},
}

if !features.ThreePointOhBeta() {
out = append(out, devspace.Registration{})
}
return out
}()
}
4 changes: 2 additions & 2 deletions internal/services/appservice/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (r Registration) Name() string {
}

func (r Registration) DataSources() []sdk.DataSource {
if features.ThreePointOhAppServiceResources() {
if features.ThreePointOhBeta() {
return []sdk.DataSource{
AppServiceSourceControlTokenDataSource{},
LinuxFunctionAppDataSource{},
Expand All @@ -36,7 +36,7 @@ func (r Registration) DataSources() []sdk.DataSource {
}

func (r Registration) Resources() []sdk.Resource {
if features.ThreePointOhAppServiceResources() {
if features.ThreePointOhBeta() {
return []sdk.Resource{
AppServiceSourceControlTokenResource{},
FunctionAppActiveSlotResource{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
resource.Schema[k] = v
}

if features.KubeConfigsAreSensitive() {
if features.ThreePointOhBeta() {
resource.Schema["kube_config"] = &pluginsdk.Schema{
Type: pluginsdk.TypeList,
Computed: true,
Expand Down
19 changes: 0 additions & 19 deletions internal/services/devspace/client/client.go

This file was deleted.

Loading

0 comments on commit dd38de2

Please sign in to comment.