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

Upgrading to SDK v20.1.0 / Go-AutoRest v10.15.3 #1861

Merged
merged 6 commits into from
Sep 7, 2018
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/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
appinsights "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights"
"github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation"
"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-04-01/containerinstance"
"github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry"
"github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2018-03-31/containerservice"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/data_source_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"sort"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
14 changes: 6 additions & 8 deletions azurerm/data_source_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ func dataSourceArmKubernetesCluster() *schema.Resource {
Computed: true,
},

// TODO: remove this in a future version
"dns_prefix": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Deprecated: "This field is no longer returned from the Azure API",
},

"vm_size": {
Expand Down Expand Up @@ -307,7 +309,7 @@ func dataSourceArmKubernetesClusterRead(d *schema.ResourceData, meta interface{}
return fmt.Errorf("Error setting `network_profile`: %+v", err)
}

servicePrincipal := flattenKubernetesClusterDataSourceServicePrincipalProfile(resp.ManagedClusterProperties.ServicePrincipalProfile)
servicePrincipal := flattenKubernetesClusterDataSourceServicePrincipalProfile(props.ServicePrincipalProfile)
if err := d.Set("service_principal", servicePrincipal); err != nil {
return fmt.Errorf("Error setting `service_principal`: %+v", err)
}
Expand Down Expand Up @@ -366,10 +368,6 @@ func flattenKubernetesClusterDataSourceAgentPoolProfiles(input *[]containerservi
agentPoolProfile["count"] = int(*profile.Count)
}

if profile.DNSPrefix != nil {
agentPoolProfile["dns_prefix"] = *profile.DNSPrefix
}

if profile.Name != nil {
agentPoolProfile["name"] = *profile.Name
}
Expand Down Expand Up @@ -400,7 +398,7 @@ func flattenKubernetesClusterDataSourceAgentPoolProfiles(input *[]containerservi
return agentPoolProfiles
}

func flattenKubernetesClusterDataSourceServicePrincipalProfile(profile *containerservice.ServicePrincipalProfile) []interface{} {
func flattenKubernetesClusterDataSourceServicePrincipalProfile(profile *containerservice.ManagedClusterServicePrincipalProfile) []interface{} {
if profile == nil {
return []interface{}{}
}
Expand Down
2 changes: 1 addition & 1 deletion azurerm/encryption_settings.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package azurerm

import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_availability_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"strings"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_availability_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand Down Expand Up @@ -179,7 +180,7 @@ func testCheckAzureRMAvailabilitySetDisappears(name string) resource.TestCheckFu
ctx := testAccProvider.Meta().(*ArmClient).StopContext
resp, err := client.Delete(ctx, resourceGroup, availSetName)
if err != nil {
if !utils.ResponseWasNotFound(resp.Response) {
if !response.WasNotFound(resp.Response) {
return fmt.Errorf("Bad: Delete on availSetClient: %+v", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
Expand Down
18 changes: 7 additions & 11 deletions azurerm/resource_arm_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ func resourceArmKubernetesCluster() *schema.Resource {
ValidateFunc: validation.IntBetween(1, 50),
},

// TODO: remove this field in the next major version
"dns_prefix": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Deprecated: "This field has been removed by Azure",
},

"fqdn": {
Expand Down Expand Up @@ -575,10 +577,6 @@ func flattenAzureRmKubernetesClusterAgentPoolProfiles(profiles *[]containerservi
agentPoolProfile["count"] = int(*profile.Count)
}

if profile.DNSPrefix != nil {
agentPoolProfile["dns_prefix"] = *profile.DNSPrefix
}

if fqdn != nil {
// temporarily persist the parent FQDN here until `fqdn` is removed from the `agent_pool_profile`
agentPoolProfile["fqdn"] = *fqdn
Expand Down Expand Up @@ -614,7 +612,7 @@ func flattenAzureRmKubernetesClusterAgentPoolProfiles(profiles *[]containerservi
return agentPoolProfiles
}

func flattenAzureRmKubernetesClusterServicePrincipalProfile(profile *containerservice.ServicePrincipalProfile) *schema.Set {
func flattenAzureRmKubernetesClusterServicePrincipalProfile(profile *containerservice.ManagedClusterServicePrincipalProfile) *schema.Set {
if profile == nil {
return nil
}
Expand Down Expand Up @@ -733,7 +731,7 @@ func expandAzureRmKubernetesClusterLinuxProfile(d *schema.ResourceData) *contain
return &profile
}

func expandAzureRmKubernetesClusterServicePrincipal(d *schema.ResourceData) *containerservice.ServicePrincipalProfile {
func expandAzureRmKubernetesClusterServicePrincipal(d *schema.ResourceData) *containerservice.ManagedClusterServicePrincipalProfile {
value, exists := d.GetOk("service_principal")
if !exists {
return nil
Expand All @@ -746,7 +744,7 @@ func expandAzureRmKubernetesClusterServicePrincipal(d *schema.ResourceData) *con
clientId := config["client_id"].(string)
clientSecret := config["client_secret"].(string)

principal := containerservice.ServicePrincipalProfile{
principal := containerservice.ManagedClusterServicePrincipalProfile{
ClientID: &clientId,
Secret: &clientSecret,
}
Expand All @@ -761,7 +759,6 @@ func expandAzureRmKubernetesClusterAgentProfiles(d *schema.ResourceData) []conta

name := config["name"].(string)
count := int32(config["count"].(int))
dnsPrefix := config["dns_prefix"].(string)
vmSize := config["vm_size"].(string)
osDiskSizeGB := int32(config["os_disk_size_gb"].(int))
osType := config["os_type"].(string)
Expand All @@ -770,7 +767,6 @@ func expandAzureRmKubernetesClusterAgentProfiles(d *schema.ResourceData) []conta
Name: utils.String(name),
Count: utils.Int32(count),
VMSize: containerservice.VMSizeTypes(vmSize),
DNSPrefix: utils.String(dnsPrefix),
OsDiskSizeGB: utils.Int32(osDiskSizeGB),
StorageProfile: containerservice.ManagedDisks,
OsType: containerservice.OSType(osType),
Expand Down
13 changes: 7 additions & 6 deletions azurerm/resource_arm_managed_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"strings"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response"
Expand Down Expand Up @@ -39,8 +39,8 @@ func resourceArmManagedDisk() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(compute.StandardLRS),
string(compute.PremiumLRS),
string(compute.StorageAccountTypesStandardLRS),
string(compute.StorageAccountTypesPremiumLRS),
}, true),
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
},
Expand Down Expand Up @@ -124,10 +124,11 @@ func resourceArmManagedDiskCreate(d *schema.ResourceData, meta interface{}) erro
zones := expandZones(d.Get("zones").([]interface{}))

var skuName compute.StorageAccountTypes
if strings.ToLower(storageAccountType) == strings.ToLower(string(compute.PremiumLRS)) {
skuName = compute.PremiumLRS
// TODO: support for the StandardSSD
if strings.EqualFold(storageAccountType, string(compute.StorageAccountTypesPremiumLRS)) {
skuName = compute.StorageAccountTypesPremiumLRS
} else {
skuName = compute.StandardLRS
skuName = compute.StorageAccountTypesStandardLRS
}

createDisk := compute.Disk{
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_managed_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"regexp"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
26 changes: 17 additions & 9 deletions azurerm/resource_arm_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/url"
"strings"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/storage"
"github.com/hashicorp/terraform/helper/hashcode"
Expand Down Expand Up @@ -1000,13 +1000,21 @@ func flattenAzureRmVirtualMachineIdentity(identity *compute.VirtualMachineIdenti
result["principal_id"] = *identity.PrincipalID
}

identity_ids := make([]string, 0)
if identity.IdentityIds != nil {
for _, id := range *identity.IdentityIds {
identity_ids = append(identity_ids, id)
identityIds := make([]string, 0)
if identity.UserAssignedIdentities != nil {
/*
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tomdevidentity/providers/Microsoft.ManagedIdentity/userAssignedIdentities/tom123": {
"principalId": "00000000-0000-0000-0000-000000000000",
"clientId": "00000000-0000-0000-0000-000000000000"
}
}
*/
for key, _ := range identity.UserAssignedIdentities {
identityIds = append(identityIds, key)
}
}
result["identity_ids"] = identity_ids
result["identity_ids"] = identityIds

return []interface{}{result}
}
Expand Down Expand Up @@ -1239,17 +1247,17 @@ func expandAzureRmVirtualMachineIdentity(d *schema.ResourceData) *compute.Virtua
identity := identities[0].(map[string]interface{})
identityType := compute.ResourceIdentityType(identity["type"].(string))

identityIds := []string{}
identityIds := make(map[string]*compute.VirtualMachineIdentityUserAssignedIdentitiesValue, 0)
for _, id := range identity["identity_ids"].([]interface{}) {
identityIds = append(identityIds, id.(string))
identityIds[id.(string)] = &compute.VirtualMachineIdentityUserAssignedIdentitiesValue{}
}

vmIdentity := compute.VirtualMachineIdentity{
Type: identityType,
}

if vmIdentity.Type == compute.ResourceIdentityTypeUserAssigned {
vmIdentity.IdentityIds = &identityIds
vmIdentity.UserAssignedIdentities = identityIds
}

return &vmIdentity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_virtual_machine_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package azurerm
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/structure"
"github.com/hashicorp/terraform/helper/validation"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_virtual_machine_managed_disks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
18 changes: 9 additions & 9 deletions azurerm/resource_arm_virtual_machine_scale_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"

"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
Expand Down Expand Up @@ -940,13 +940,13 @@ func flattenAzureRmVirtualMachineScaleSetIdentity(identity *compute.VirtualMachi
result["principal_id"] = *identity.PrincipalID
}

identity_ids := make([]string, 0)
if identity.IdentityIds != nil {
for _, id := range *identity.IdentityIds {
identity_ids = append(identity_ids, id)
identityIds := make([]string, 0)
if identity.UserAssignedIdentities != nil {
for key, _ := range identity.UserAssignedIdentities {
identityIds = append(identityIds, key)
}
}
result["identity_ids"] = identity_ids
result["identity_ids"] = identityIds

return []interface{}{result}
}
Expand Down Expand Up @@ -1633,17 +1633,17 @@ func expandAzureRmVirtualMachineScaleSetIdentity(d *schema.ResourceData) *comput
identity := identities[0].(map[string]interface{})
identityType := compute.ResourceIdentityType(identity["type"].(string))

identityIds := []string{}
identityIds := make(map[string]*compute.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, 0)
for _, id := range identity["identity_ids"].([]interface{}) {
identityIds = append(identityIds, id.(string))
identityIds[id.(string)] = &compute.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue{}
}

vmssIdentity := compute.VirtualMachineScaleSetIdentity{
Type: identityType,
}

if vmssIdentity.Type == compute.ResourceIdentityTypeUserAssigned {
vmssIdentity.IdentityIds = &identityIds
vmssIdentity.UserAssignedIdentities = identityIds
}

return &vmssIdentity
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_virtual_machine_scale_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_virtual_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
Loading