Skip to content

Commit

Permalink
Merge branch 'main' into gerrytan/datafactory-cosmosdb-mongodb-new-re…
Browse files Browse the repository at this point in the history
…source
  • Loading branch information
gerrytan committed Dec 13, 2024
2 parents d95a18f + 941b107 commit d19f37e
Show file tree
Hide file tree
Showing 268 changed files with 5,765 additions and 724 deletions.
3 changes: 3 additions & 0 deletions .github/labeler-issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ service/event-hubs:
service/extended-location:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_extended_custom_location((.|\n)*)###'

service/fabric:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_fabric_capacity((.|\n)*)###'

service/firewall:
- '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_firewall((.|\n)*)###'

Expand Down
5 changes: 5 additions & 0 deletions .github/labeler-pull-request-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ service/extended-location:
- any-glob-to-any-file:
- internal/services/extendedlocation/**/*

service/fabric:
- changed-files:
- any-glob-to-any-file:
- internal/services/fabric/**/*

service/firewall:
- changed-files:
- any-glob-to-any-file:
Expand Down
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var services = mapOf(
"eventgrid" to "EventGrid",
"eventhub" to "EventHub",
"extendedlocation" to "ExtendedLocation",
"fabric" to "Fabric",
"firewall" to "Firewall",
"fluidrelay" to "Fluid Relay",
"frontdoor" to "FrontDoor",
Expand Down
18 changes: 9 additions & 9 deletions contributing/topics/guide-breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ The following example follows a fictional resource that will have the following
},
}
if !features.FivePointOhBeta {
if !features.FivePointOhBeta() {
args["enable_scaling"] = &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Optional: true,
Expand Down Expand Up @@ -241,7 +241,7 @@ The following example follows a fictional resource that will have the following
### `azurerm_example_resource`
* The deprecated `scaling_enabled` property has been removed in favour of the `scaling_enabled` property.
* The deprecated `enable_scaling` property has been removed in favour of the `scaling_enabled` property.
* The property `version` now defaults to `2`.
```
Expand Down Expand Up @@ -336,11 +336,11 @@ Terraform will perform the following actions:
Plan: 0 to add, 1 to change, 0 to destroy.
```

This is a breaking change as Terraform should not trigger a plan between minor version upgrades. Instead, what we can do is add a TODO next to the `Default` tag to update the default value in the next major version of the provider or mark the field as Required if that default value is going to continue to change in the future:
This is a breaking change as Terraform should not trigger a plan between minor version upgrades. Instead, what we can do is use the major release feature flag as shown in the example below or mark the field as Required if that default value is going to continue to change in the future:

```go
func (r SparkResource) Arguments() map[string]*pluginsdk.Schema{
args := map[string]*pluginsdk.Schema{
args := map[string]*pluginsdk.Schema{
"spark_version": {
Type: pluginsdk.TypeString,
Optional: true,
Expand All @@ -353,13 +353,13 @@ func (r SparkResource) Arguments() map[string]*pluginsdk.Schema{
"3.4",
}, false),
},
}
}
if !features.FivePointOhBeta() {
args["spark_version"].Default = "2.4"
}
if !features.FivePointOhBeta() {
args["spark_version"].Default = "2.4"
}
return args
return args
}
```

Expand Down
66 changes: 39 additions & 27 deletions contributing/topics/guide-new-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,46 +681,58 @@ In Go tests are expected to be in a file name in the format `{original_file_name
package resource_test

import (
"context"
"fmt"
"testing"

"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/utils"
"context"
"fmt"
"testing"

"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/services/resource/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/utils"
)

type ResourceGroupExampleTestResource struct{}

func TestAccResourceGroupExample_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_resource_group_example", "test")
testResource := ResourceGroupExampleTestResource{}
data.ResourceTest(t, testResource, []acceptance.TestStep{
data.ApplyStep(testResource.basicConfig, testResource),
r := ResourceGroupExampleTestResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r)
),
},
data.ImportStep(),
})
}

func TestAccResourceGroupExample_requiresImport(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_resource_group_example", "test")
testResource := ResourceGroupExampleTestResource{}
data.ResourceTest(t, testResource, []acceptance.TestStep{
data.ApplyStep(testResource.basicConfig, testResource),
data.RequiresImportErrorStep(testResource.requiresImportConfig),
r := ResourceGroupExampleTestResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
ExpectError: acceptance.RequiresImportError("azurerm_resource_group_example"),
},
})
}

func TestAccResourceGroupExample_complete(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_resource_group_example", "test")
testResource := ResourceGroupExampleTestResource{}
data.ResourceTest(t, testResource, []acceptance.TestStep{
data.ApplyStep(testResource.completeConfig, testResource),
data.ImportStep(),
data.ApplyStep(testResource.basicConfig, testResource),
data.ImportStep(),
data.ApplyStep(testResource.completeConfig, testResource),
r := ResourceGroupExampleTestResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r)
),
},
data.ImportStep(),
})
}
Expand All @@ -739,7 +751,7 @@ func (ResourceGroupExampleTestResource) Exists(ctx context.Context, client *clie
return pointer.To(resp.Model != nil), nil
}

func (ResourceGroupExampleTestResource) basicConfig(data acceptance.TestData) string {
func (ResourceGroupExampleTestResource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand All @@ -752,8 +764,8 @@ resource "azurerm_resource_group_example" "test" {
`, data.RandomInteger, data.Locations.Primary)
}

func (r ResourceGroupExampleTestResource) requiresImportConfig(data acceptance.TestData) string {
template := r.basicConfig(data)
func (r ResourceGroupExampleTestResource) requiresImport(data acceptance.TestData) string {
template := r.basic(data)
return fmt.Sprintf(`
%s
Expand All @@ -764,7 +776,7 @@ resource "azurerm_resource_group_example" "import" {
`, template)
}

func (ResourceGroupExampleTestResource) completeConfig(data acceptance.TestData) string {
func (ResourceGroupExampleTestResource) complete(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ require (
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/hashicorp/go-azure-helpers v0.71.0
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539
github.com/hashicorp/go-azure-sdk/sdk v0.20241128.1112539
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241206.1180327
github.com/hashicorp/go-azure-sdk/sdk v0.20241206.1180327
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-uuid v1.0.3
Expand All @@ -35,7 +35,6 @@ require (
github.com/rickb777/date v1.12.5-0.20200422084442-6300e543c4d9
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
github.com/tombuildsstuff/giovanni v0.27.0
github.com/tombuildsstuff/kermit v0.20240122.1123108
golang.org/x/crypto v0.29.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -68,6 +67,7 @@ require (
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
Expand Down
13 changes: 6 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.71.0 h1:ra3aIRzg01g6MLKQ+yABcb6WJtrqRUDDgyuPLmyZ9lY=
github.com/hashicorp/go-azure-helpers v0.71.0/go.mod h1:BmbF4JDYXK5sEmFeU5hcn8Br21uElcqLfdQxjatwQKw=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539 h1:rHh2P5qcPObzpfAFafIjle3CowejFAHTfBJAHDkuSGk=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241128.1112539/go.mod h1:oQAUu+aCHPCM0CDfsQTBnEkfUZ+sLhEW8Ssip9AeCLc=
github.com/hashicorp/go-azure-sdk/sdk v0.20241128.1112539 h1:6Ps2V/DBwBxWEjSx01fM+PqG+uIavHWvxmM2vb1N2Ok=
github.com/hashicorp/go-azure-sdk/sdk v0.20241128.1112539/go.mod h1:oI5R0fTbBx3K/sJBK5R/OlEy8ozdQjvctxVU9v3EDkc=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241206.1180327 h1:6b8IGRB1RpeFUtUym6bf+GJgyWuQpZq+fa/dBpHgPIE=
github.com/hashicorp/go-azure-sdk/resource-manager v0.20241206.1180327/go.mod h1:Y2T5KK4QAV+/tGfcwp5BzPRQs5/cbIXT/igtHqYZ09U=
github.com/hashicorp/go-azure-sdk/sdk v0.20241206.1180327 h1:c7Y0wwTOdna2dndVW1nalZ/DZX1wDQCSj2JNgiLycKw=
github.com/hashicorp/go-azure-sdk/sdk v0.20241206.1180327/go.mod h1:oI5R0fTbBx3K/sJBK5R/OlEy8ozdQjvctxVU9v3EDkc=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
Expand Down Expand Up @@ -169,8 +169,9 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/magodo/terraform-provider-azurerm-example-gen v0.0.0-20220407025246-3a3ee0ab24a8 h1:HHSqLmPZaa8U66U7N2Gtx3gYptSHrUB/rB5t+6fZTkQ=
github.com/magodo/terraform-provider-azurerm-example-gen v0.0.0-20220407025246-3a3ee0ab24a8/go.mod h1:iMzpAzVr2v/NUVie/apAYtZlFZYFndPcp6/E0VLxgAM=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand Down Expand Up @@ -234,8 +235,6 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tombuildsstuff/giovanni v0.27.0 h1:3CDNjauK78FIhvvCp0SAHlvNcPTcofR6zQXvxwhk4zY=
github.com/tombuildsstuff/giovanni v0.27.0/go.mod h1:SviBdlwdVn2HyArdRABBqMUODBJ2adQHi+RFEVaO05I=
github.com/tombuildsstuff/kermit v0.20240122.1123108 h1:icQaxsv/ANv/KC4Sr0V1trrWA/XIL+3QAVBDpiSTgj8=
github.com/tombuildsstuff/kermit v0.20240122.1123108/go.mod h1:T3YBVFhRV4qA7SbnRaNE6eapIMpKDA9rG/V7Ocsjlno=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
Expand Down
9 changes: 7 additions & 2 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
dns_v2018_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01"
fluidrelay_2022_05_26 "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26"
hdinsight_v2021_06_01 "github.com/hashicorp/go-azure-sdk/resource-manager/hdinsight/2021-06-01"
nginx_2024_06_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-06-01-preview"
nginx_2024_11_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-11-01-preview"
redis_2024_03_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2024-03-01"
servicenetworking_2023_11_01 "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-11-01"
storagecache_2023_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-05-01"
Expand Down Expand Up @@ -73,6 +73,7 @@ import (
eventgrid "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/client"
eventhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/client"
extendedlocation "github.com/hashicorp/terraform-provider-azurerm/internal/services/extendedlocation/client"
fabric "github.com/hashicorp/terraform-provider-azurerm/internal/services/fabric/client"
fluidrelay "github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/client"
frontdoor "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/client"
graph "github.com/hashicorp/terraform-provider-azurerm/internal/services/graphservices/client"
Expand Down Expand Up @@ -208,6 +209,7 @@ type Client struct {
EventGrid *eventgrid.Client
Eventhub *eventhub.Client
ExtendedLocation *extendedlocation.Client
Fabric *fabric.Client
FluidRelay *fluidrelay_2022_05_26.Client
Frontdoor *frontdoor.Client
Graph *graph.Client
Expand Down Expand Up @@ -241,7 +243,7 @@ type Client struct {
Network *network.Client
NetworkFunction *networkfunction.Client
NewRelic *newrelic.Client
Nginx *nginx_2024_06_01_preview.Client
Nginx *nginx_2024_11_01_preview.Client
NotificationHubs *notificationhub.Client
Oracle *oracle.Client
Orbital *orbital.Client
Expand Down Expand Up @@ -447,6 +449,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error
if client.ExtendedLocation, err = extendedlocation.NewClient(o); err != nil {
return fmt.Errorf("building clients for ExtendedLocation: %+v", err)
}
if client.Fabric, err = fabric.NewClient(o); err != nil {
return fmt.Errorf("building clients for Fabric: %+v", err)
}
if client.FluidRelay, err = fluidrelay.NewClient(o); err != nil {
return fmt.Errorf("building clients for FluidRelay: %+v", err)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/extendedlocation"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/fabric"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor"
Expand Down Expand Up @@ -173,6 +174,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
eventgrid.Registration{},
eventhub.Registration{},
extendedlocation.Registration{},
fabric.Registration{},
fluidrelay.Registration{},
graphservices.Registration{},
hybridcompute.Registration{},
Expand Down
Loading

0 comments on commit d19f37e

Please sign in to comment.