Skip to content

Commit

Permalink
Merge branch 'main' into data_collection_rule
Browse files Browse the repository at this point in the history
  • Loading branch information
teowa authored Jun 23, 2022
2 parents f499345 + 56ad1d0 commit 3b15967
Show file tree
Hide file tree
Showing 270 changed files with 11,638 additions and 18,442 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ ENHANCEMENTS:
* dependencies: updating to `v0.20220622.1090000` of `github.com/hashicorp/go-azure-sdk` [GH-17339]
* batch: updating to use API Version `2022-01-01` [GH-17219]
* confidentialledger: updating to use API Version `2022-05-13` [GH-17146]
* desktopvirtualization: refactoring to use `hashicorp/go-azure-sdk` [GH-17340]
* Data Source: `azurerm_managed_disk` - exporting `disk_access_id` [GH-17270]
* Data Source: `azurerm_managed_disk` - exporting `network_access_policy` [GH-17270]

BUG FIXES:

* Data Source: `azurerm_mysql_flexible_server` - generate the correct terraform resource ID [GH-17301]
* `azurerm_shared_image` - the `privacy_statement_uri`, `publisher`, `offer` and `sku` fields are now ForceNew [GH-17289]
* `azurerm_shared_image_*` - Fix validation for `gallery_name` [GH-17201]


## 3.10.0 (June 09, 2022)

FEATURES:
Expand Down
26 changes: 20 additions & 6 deletions internal/services/compute/dedicated_host_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,48 @@ func resourceDedicatedHost() *pluginsdk.Resource {
ForceNew: true,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"DSv3-Type1",
"DSv3-Type2",
"DSv4-Type1",
"ESv3-Type1",
"ESv3-Type2",
"FSv2-Type2",
"DADSv5-Type1",
"DASv4-Type1",
"DASv4-Type2",
"DASv5-Type1",
"DCSv2-Type1",
"DDSv4-Type1",
"DDSv4-Type2",
"DDSv5-Type1",
"DSv3-Type1",
"DSv3-Type2",
"DSv3-Type3",
"DSv3-Type4",
"DSv4-Type1",
"DSv4-Type2",
"DSv5-Type1",
"EADSv5-Type1",
"EASv4-Type1",
"EASv4-Type2",
"EASv5-Type1",
"EDSv4-Type1",
"EDSv4-Type2",
"EDSv5-Type1",
"ESv3-Type1",
"ESv3-Type2",
"ESv3-Type3",
"ESv3-Type4",
"ESv4-Type1",
"ESv4-Type2",
"ESv5-Type1",
"FSv2-Type2",
"FSv2-Type3",
"FSv2-Type4",
"FXmds-Type1",
"LSv2-Type1",
"MDMSv2MedMem-Type1",
"MDSv2MedMem-Type1",
"MMSv2MedMem-Type1",
"MS-Type1",
"MSm-Type1",
"MSmv2-Type1",
"MSv2-Type1",
"MSv2MedMem-Type1",
"NVASv4-Type1",
"NVSv3-Type1",
}, false),
Expand Down
4 changes: 4 additions & 0 deletions internal/services/compute/shared_image_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,17 @@ func resourceSharedImage() *pluginsdk.Resource {
Schema: map[string]*pluginsdk.Schema{
"publisher": {
Type: pluginsdk.TypeString,
ForceNew: true,
Required: true,
},
"offer": {
Type: pluginsdk.TypeString,
ForceNew: true,
Required: true,
},
"sku": {
Type: pluginsdk.TypeString,
ForceNew: true,
Required: true,
},
},
Expand Down Expand Up @@ -142,6 +145,7 @@ func resourceSharedImage() *pluginsdk.Resource {

"privacy_statement_uri": {
Type: pluginsdk.TypeString,
ForceNew: true,
Optional: true,
},

Expand Down
178 changes: 178 additions & 0 deletions internal/services/compute/shared_image_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,48 @@ func TestAccSharedImage_withAcceleratedNetworkSupportEnabled(t *testing.T) {
})
}

func TestAccSharedImage_description(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_shared_image", "test")
r := SharedImageResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.description(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.descriptionUpdated(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func TestAccSharedImage_releaseNoteURI(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_shared_image", "test")
r := SharedImageResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.releaseNoteURI(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.releaseNoteURIUpdated(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func (t SharedImageResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.SharedImageID(state.ID)
if err != nil {
Expand Down Expand Up @@ -348,3 +390,139 @@ resource "azurerm_shared_image" "test" {
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}

func (SharedImageResource) description(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%[2]d"
location = "%[1]s"
}
resource "azurerm_shared_image_gallery" "test" {
name = "acctestsig%[2]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
}
resource "azurerm_shared_image" "test" {
name = "acctestimg%[2]d"
gallery_name = azurerm_shared_image_gallery.test.name
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
os_type = "Linux"
description = "image description"
identifier {
publisher = "AccTesPublisher%[2]d"
offer = "AccTesOffer%[2]d"
sku = "AccTesSku%[2]d"
}
}
`, data.Locations.Primary, data.RandomInteger)
}

func (SharedImageResource) descriptionUpdated(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%[2]d"
location = "%[1]s"
}
resource "azurerm_shared_image_gallery" "test" {
name = "acctestsig%[2]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
}
resource "azurerm_shared_image" "test" {
name = "acctestimg%[2]d"
gallery_name = azurerm_shared_image_gallery.test.name
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
os_type = "Linux"
description = "image description updated"
identifier {
publisher = "AccTesPublisher%[2]d"
offer = "AccTesOffer%[2]d"
sku = "AccTesSku%[2]d"
}
}
`, data.Locations.Primary, data.RandomInteger)
}

func (SharedImageResource) releaseNoteURI(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%[2]d"
location = "%[1]s"
}
resource "azurerm_shared_image_gallery" "test" {
name = "acctestsig%[2]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
}
resource "azurerm_shared_image" "test" {
name = "acctestimg%[2]d"
gallery_name = azurerm_shared_image_gallery.test.name
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
os_type = "Linux"
release_note_uri = "https://test.com/changelog.md"
identifier {
publisher = "AccTesPublisher%[2]d"
offer = "AccTesOffer%[2]d"
sku = "AccTesSku%[2]d"
}
}
`, data.Locations.Primary, data.RandomInteger)
}

func (SharedImageResource) releaseNoteURIUpdated(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%[2]d"
location = "%[1]s"
}
resource "azurerm_shared_image_gallery" "test" {
name = "acctestsig%[2]d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
}
resource "azurerm_shared_image" "test" {
name = "acctestimg%[2]d"
gallery_name = azurerm_shared_image_gallery.test.name
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
os_type = "Linux"
release_note_uri = "https://test.com/changelog2.md"
identifier {
publisher = "AccTesPublisher%[2]d"
offer = "AccTesOffer%[2]d"
sku = "AccTesSku%[2]d"
}
}
`, data.Locations.Primary, data.RandomInteger)
}
70 changes: 35 additions & 35 deletions internal/services/desktopvirtualization/client/client.go
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
ApplicationGroupsClient *desktopvirtualization.ApplicationGroupsClient
ApplicationsClient *desktopvirtualization.ApplicationsClient
DesktopsClient *desktopvirtualization.DesktopsClient
HostPoolsClient *desktopvirtualization.HostPoolsClient
OperationsClient *desktopvirtualization.OperationsClient
SessionHostsClient *desktopvirtualization.SessionHostsClient
ScalingPlansClient *desktopvirtualization.ScalingPlansClient
WorkspacesClient *desktopvirtualization.WorkspacesClient
ApplicationGroupsClient *applicationgroup.ApplicationGroupClient
ApplicationsClient *application.ApplicationClient
DesktopsClient *desktop.DesktopClient
HostPoolsClient *hostpool.HostPoolClient
SessionHostsClient *sessionhost.SessionHostClient
ScalingPlansClient *scalingplan.ScalingPlanClient
WorkspacesClient *workspace.WorkspaceClient
}

// NewClient - New client for desktop virtualization
func NewClient(o *common.ClientOptions) *Client {
ApplicationGroupsClient := desktopvirtualization.NewApplicationGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ApplicationGroupsClient.Client, o.ResourceManagerAuthorizer)
applicationGroupsClient := applicationgroup.NewApplicationGroupClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&applicationGroupsClient.Client, o.ResourceManagerAuthorizer)

ApplicationsClient := desktopvirtualization.NewApplicationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ApplicationsClient.Client, o.ResourceManagerAuthorizer)
applicationsClient := application.NewApplicationClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&applicationsClient.Client, o.ResourceManagerAuthorizer)

DesktopsClient := desktopvirtualization.NewDesktopsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&DesktopsClient.Client, o.ResourceManagerAuthorizer)
desktopsClient := desktop.NewDesktopClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&desktopsClient.Client, o.ResourceManagerAuthorizer)

HostPoolsClient := desktopvirtualization.NewHostPoolsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&HostPoolsClient.Client, o.ResourceManagerAuthorizer)
hostPoolsClient := hostpool.NewHostPoolClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&hostPoolsClient.Client, o.ResourceManagerAuthorizer)

OperationsClient := desktopvirtualization.NewOperationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&OperationsClient.Client, o.ResourceManagerAuthorizer)
sessionHostsClient := sessionhost.NewSessionHostClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&sessionHostsClient.Client, o.ResourceManagerAuthorizer)

SessionHostsClient := desktopvirtualization.NewSessionHostsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&SessionHostsClient.Client, o.ResourceManagerAuthorizer)
scalingPlansClient := scalingplan.NewScalingPlanClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&scalingPlansClient.Client, o.ResourceManagerAuthorizer)

ScalingPlansClient := desktopvirtualization.NewScalingPlansClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&ScalingPlansClient.Client, o.ResourceManagerAuthorizer)

WorkspacesClient := desktopvirtualization.NewWorkspacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&WorkspacesClient.Client, o.ResourceManagerAuthorizer)
workspacesClient := workspace.NewWorkspaceClientWithBaseURI(o.ResourceManagerEndpoint)
o.ConfigureClient(&workspacesClient.Client, o.ResourceManagerAuthorizer)

return &Client{
ApplicationGroupsClient: &ApplicationGroupsClient,
ApplicationsClient: &ApplicationsClient,
DesktopsClient: &DesktopsClient,
HostPoolsClient: &HostPoolsClient,
OperationsClient: &OperationsClient,
SessionHostsClient: &SessionHostsClient,
ScalingPlansClient: &ScalingPlansClient,
WorkspacesClient: &WorkspacesClient,
ApplicationGroupsClient: &applicationGroupsClient,
ApplicationsClient: &applicationsClient,
DesktopsClient: &desktopsClient,
HostPoolsClient: &hostPoolsClient,
SessionHostsClient: &sessionHostsClient,
ScalingPlansClient: &scalingPlansClient,
WorkspacesClient: &workspacesClient,
}
}
Loading

0 comments on commit 3b15967

Please sign in to comment.