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

deps: update maps to 2021-02-01, add G2 SKU #11676

Merged
merged 1 commit into from
May 13, 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
2 changes: 1 addition & 1 deletion azurerm/internal/services/maps/client/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2018-05-01/maps"
"github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common"
)

Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/maps/maps_account_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func dataSourceMapsAccountRead(d *schema.ResourceData, meta interface{}) error {
d.Set("sku_name", sku.Name)
}
if props := resp.Properties; props != nil {
d.Set("x_ms_client_id", props.XMsClientID)
d.Set("x_ms_client_id", props.UniqueID)
}

keysResp, err := client.ListKeys(ctx, resourceGroup, name)
Expand Down
13 changes: 7 additions & 6 deletions azurerm/internal/services/maps/maps_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2018-05-01/maps"
"github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down Expand Up @@ -53,8 +53,9 @@ func resourceMapsAccount() *schema.Resource {
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"S0",
"S1",
string(maps.NameS0),
string(maps.NameS1),
string(maps.NameG2),
}, false),
},

Expand Down Expand Up @@ -105,10 +106,10 @@ func resourceMapsAccountCreateUpdate(d *schema.ResourceData, meta interface{}) e
}
}

parameters := maps.AccountCreateParameters{
parameters := maps.Account{
Location: utils.String("global"),
Sku: &maps.Sku{
Name: &sku,
Name: maps.Name(sku),
},
Tags: tags.Expand(t),
}
Expand Down Expand Up @@ -157,7 +158,7 @@ func resourceMapsAccountRead(d *schema.ResourceData, meta interface{}) error {
d.Set("sku_name", sku.Name)
}
if props := resp.Properties; props != nil {
d.Set("x_ms_client_id", props.XMsClientID)
d.Set("x_ms_client_id", props.UniqueID)
}

keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.Name)
Expand Down
27 changes: 23 additions & 4 deletions azurerm/internal/services/maps/maps_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestAccMapsAccount_sku(t *testing.T) {

data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.sku(data),
Config: r.sku(data, "S1"),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("name").Exists(),
check.That(data.ResourceName).Key("x_ms_client_id").Exists(),
Expand All @@ -55,6 +55,25 @@ func TestAccMapsAccount_sku(t *testing.T) {
})
}

func TestAccMapsAccount_skuG2(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_maps_account", "test")
r := MapsAccountResource{}

data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.sku(data, "G2"),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("name").Exists(),
check.That(data.ResourceName).Key("x_ms_client_id").Exists(),
check.That(data.ResourceName).Key("primary_access_key").Exists(),
check.That(data.ResourceName).Key("secondary_access_key").Exists(),
check.That(data.ResourceName).Key("sku_name").HasValue("G2"),
),
},
data.ImportStep(),
})
}

func TestAccMapsAccount_tags(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_maps_account", "test")
r := MapsAccountResource{}
Expand Down Expand Up @@ -113,7 +132,7 @@ resource "azurerm_maps_account" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

func (MapsAccountResource) sku(data acceptance.TestData) string {
func (MapsAccountResource) sku(data acceptance.TestData, sku string) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand All @@ -127,9 +146,9 @@ resource "azurerm_resource_group" "test" {
resource "azurerm_maps_account" "test" {
name = "accMapsAccount-%d"
resource_group_name = azurerm_resource_group.test.name
sku_name = "S1"
sku_name = "%s"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, sku)
}

func (MapsAccountResource) tags(data acceptance.TestData) string {
Expand Down

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading