Skip to content

Commit

Permalink
Merge branch 'hashicorp:main' into fix-dv-hp-regtoken
Browse files Browse the repository at this point in the history
  • Loading branch information
amccullough84 authored Nov 15, 2021
2 parents f59d172 + f5f4260 commit baa8d11
Show file tree
Hide file tree
Showing 563 changed files with 63,847 additions and 25,401 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/depscheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make depscheck
2 changes: 1 addition & 1 deletion .github/workflows/gencheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make gencheck
2 changes: 1 addition & 1 deletion .github/workflows/golint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- uses: golangci/golangci-lint-action@v2
with:
version: 'v1.41.1'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradually-deprecated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: ./scripts/run-gradually-deprecated.sh
2 changes: 1 addition & 1 deletion .github/workflows/link-milestone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: |
go install github.com/stephybun/link-milestone@latest
link-milestone
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tflint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make tflint
2 changes: 1 addition & 1 deletion .github/workflows/thirty-two-bit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: GOARCH=386 GOOS=linux go build -o 32bitbuild .
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: bash scripts/gogetcookie.sh
- run: make test
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make validate-examples
2 changes: 1 addition & 1 deletion .github/workflows/website-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.7'
go-version: '1.17.3'
- run: bash scripts/gogetcookie.sh
- run: make tools
- run: make website-lint
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.7
1.17.3
61 changes: 46 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,58 @@
## 2.85.0 (Unreleased)
## 2.86.0 (Unreleased)

IMPROVEMENTS:

* compute: updating to use API Version `2021-07-01` [GH-14174]
* databricks: updating the embedded SDK to use the new Resource ID Parsers [GH-14157]
* datalake: updating the embedded SDK to use the new Resource ID Parsers [GH-14158]
* maps: updating the embedded SDK to use the new Resource ID Parsers [GH-14155]
* powerbi: updating the embedded SDK to use the new Resource ID Parsers [GH-14154]
* relay: updating the embedded SDK to use the new Resource ID Parsers [GH-14153]
* signalr: updating the embedded SDK to use the new Resource ID Parsers [GH-14150]
* storage: updating to use API Version `2021-04-01` [GH-14083]
* videoanalyzer: updating the embedded SDK to use the new Resource ID Parsers [GH-14135]
* `azurerm_orchestrated_virtual_machine_scale_set` - added support for VMSS Flex public preview [GH-14003]
* `azurerm_machine_learning_workspace` - support for the `encryption` block [GH-14120]

BUG FIXES:

* `azurerm_linux_virtual_machine_scale_set` - `source_image_reference.offer` and `source_image_reference.publisher` are now ForceNew [GH-14165]
* `azurerm_windows_virtual_machine_scale_set` - `source_image_reference.offer` and `source_image_reference.publisher` are now ForceNew [GH-14165]
* `azurerm_network_watcher_flow_log` - now locks on the network security group to prevent `AnotherOperationInProgress` errors [GH-14160]

## 2.85.0 (November 12, 2021)

FEATURES:

* **New Data Source:** `azurerm_batch_application` [GH-14043]
* **New Data Source:** `azurerm_batch_application` ([#14043](https://github.com/hashicorp/terraform-provider-azurerm/issues/14043))
* **New Resource:** `azurerm_monitor_private_link_scope` ([#14098](https://github.com/hashicorp/terraform-provider-azurerm/issues/14098))
* **New Resource:** `azurerm_mysql_flexible_server_firewall_rule` ([#14136](https://github.com/hashicorp/terraform-provider-azurerm/issues/14136))
* **New Resource:** `azurerm_synapse_workspace_aad_admin` ([#13600](https://github.com/hashicorp/terraform-provider-azurerm/issues/13600))

IMPROVEMENTS:

* dependencies: upgrading to `v0.17.0` of `github.com/hashicorp/go-azure-helpers` [GH-14060]
* dependencies: upgrading to `v2.8.0` of `github.com/hashicorp/terraform-plugin-sdk` [GH-14060]
* `azurerm_application_insights` - support for the `internet_ingestion_enabled` and `internet_query_enabled` properties [GH-14035]
* `azurerm_security_center_subscription_pricing` - `resource_type` can now be set to `OpenSourceRelationalDatabases` [GH-14103]
* dependencies: upgrading to `v0.17.1` of `github.com/hashicorp/go-azure-helpers` ([#14141](https://github.com/hashicorp/terraform-provider-azurerm/issues/14141))
* dependencies: upgrading to `v2.8.0` of `github.com/hashicorp/terraform-plugin-sdk` ([#14060](https://github.com/hashicorp/terraform-provider-azurerm/issues/14060))
* `azurerm_application_insights` - support for the `internet_ingestion_enabled` and `internet_query_enabled` properties ([#14035](https://github.com/hashicorp/terraform-provider-azurerm/issues/14035))
* `azurerm_backup_protected_vm` - support for the `exclude_disk_luns` and `include_disk_luns` properties ([#14097](https://github.com/hashicorp/terraform-provider-azurerm/issues/14097))
* `azurerm_managed_disk_resource` - support for the `disk_iops_read_only` and `disk_mbps_read_only` properties ([#14025](https://github.com/hashicorp/terraform-provider-azurerm/issues/14025))
* `azurerm_security_center_subscription_pricing` - `resource_type` can now be set to `OpenSourceRelationalDatabases` ([#14103](https://github.com/hashicorp/terraform-provider-azurerm/issues/14103))
* `azurerm_storage_encryption_scope` - allow versionless `key_vault_key_id` ([#14085](https://github.com/hashicorp/terraform-provider-azurerm/issues/14085))
* `azurerm_sql_managed_instance` - support for the `identity` block ([#14052](https://github.com/hashicorp/terraform-provider-azurerm/issues/14052))
* `azurerm_virtual_network_gateway` - enable configuration of an active-active zone redundant gateway with P2S ([#14124](https://github.com/hashicorp/terraform-provider-azurerm/issues/14124))

BUG FIXES:

* Data Source: `azurerm_redis_cache` - parsing the `subnet_id` response value case-insensitively [GH-14108]
* Data Source: `azurerm_redis_cache` - ensuring that `shard_count` always has a value set [GH-14108]
* Data Source: `azurerm_consumption_budget_resource_group` - add missing `threshold_type` property in the schema [GH-14125]
* Data Source: `azurerm_consumption_budget_subscription` - add missing `threshold_type` property in the schema [GH-14125]
* `azurerm_api_management_certificate` - set `subject` property from correct field [GH-14026]
* `azurerm_app_service_virtual_network_swift_connection` - fixing a panic when checking for an existing resource during creation [GH-14070]
* `azurerm_redis_cache` - parsing the `subnet_id` response value case-insensitively [GH-14108]
* `azurerm_redis_cache` - ensuring that `shard_count` always has a value set [GH-14108]
* `azurerm_storage_blob` - ensuring that `cache_control` is sent during updates [GH-14100]
* Data Source: `azurerm_redis_cache` - parsing the `subnet_id` response value case-insensitively ([#14108](https://github.com/hashicorp/terraform-provider-azurerm/issues/14108))
* Data Source: `azurerm_redis_cache` - ensuring that `shard_count` always has a value set ([#14108](https://github.com/hashicorp/terraform-provider-azurerm/issues/14108))
* Data Source: `azurerm_consumption_budget_resource_group` - add missing `threshold_type` property in the schema ([#14125](https://github.com/hashicorp/terraform-provider-azurerm/issues/14125))
* Data Source: `azurerm_consumption_budget_subscription` - add missing `threshold_type` property in the schema ([#14125](https://github.com/hashicorp/terraform-provider-azurerm/issues/14125))
* `azurerm_api_management_certificate` - set `subject` property from correct field ([#14026](https://github.com/hashicorp/terraform-provider-azurerm/issues/14026))
* `azurerm_app_service_virtual_network_swift_connection` - fixing a panic when checking for an existing resource during creation ([#14070](https://github.com/hashicorp/terraform-provider-azurerm/issues/14070))
* `azurerm_frontdoor_resource` - route engines are no longer removed on update ([#14093](https://github.com/hashicorp/terraform-provider-azurerm/issues/14093))
* `azurerm_redis_cache` - parsing the `subnet_id` response value case-insensitively ([#14108](https://github.com/hashicorp/terraform-provider-azurerm/issues/14108))
* `azurerm_redis_cache` - ensuring that `shard_count` always has a value set ([#14108](https://github.com/hashicorp/terraform-provider-azurerm/issues/14108))
* `azurerm_storage_blob` - ensuring that `cache_control` is sent during updates ([#14100](https://github.com/hashicorp/terraform-provider-azurerm/issues/14100))

## 2.84.0 (November 05, 2021)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Further [usage documentation is available on the Terraform website](https://regi
## Developer Requirements

* [Terraform](https://www.terraform.io/downloads.html) version 0.12.x + (but 1.x is recommended)
* [Go](https://golang.org/doc/install) version 1.16.x (to build the provider plugin)
* [Go](https://golang.org/doc/install) version 1.17.x (to build the provider plugin)

### On Windows

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/google/go-cmp v0.5.6
github.com/google/uuid v1.1.2
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-azure-helpers v0.17.0
github.com/hashicorp/go-azure-helpers v0.17.1
github.com/hashicorp/go-getter v1.5.4
github.com/hashicorp/go-hclog v0.16.1 // indirect
github.com/hashicorp/go-multierror v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg=
github.com/hashicorp/go-azure-helpers v0.17.0 h1:HQF6kVNzofmwOhbRK/h/RWEVl/zu6kjB6mjoIxFL0A0=
github.com/hashicorp/go-azure-helpers v0.17.0/go.mod h1:L4ny2lW2muOESZR1XjbM59c3Pq+7SA9Yt1Nry5UfKZc=
github.com/hashicorp/go-azure-helpers v0.17.1 h1:qkvhSgyPzK3UwWQDocGLFmZ9iRjTj1Dv4CzeyhwfoIs=
github.com/hashicorp/go-azure-helpers v0.17.1/go.mod h1:L4ny2lW2muOESZR1XjbM59c3Pq+7SA9Yt1Nry5UfKZc=
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
50 changes: 50 additions & 0 deletions helpers/azure/sku.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"fmt"
"strconv"
"strings"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
"github.com/hashicorp/terraform-provider-azurerm/utils"
)

func SplitSku(sku string) (string, int32, error) {
Expand All @@ -20,3 +23,50 @@ func SplitSku(sku string) (string, int32, error) {

return skuParts[0], int32(capacity), nil
}

func ExpandOrchestratedVirtualMachineScaleSetSku(input string, capacity int) (*compute.Sku, error) {
skuParts := strings.Split(input, "_")

if len(skuParts) < 2 || strings.Contains(input, "__") || strings.Contains(input, " ") {
return nil, fmt.Errorf("'sku_name'(%q) is not formatted properly.", input)
}

sku := &compute.Sku{
Name: utils.String(input),
Capacity: utils.Int64(int64(capacity)),
Tier: utils.String("Standard"),
}

return sku, nil
}

func FlattenOrchestratedVirtualMachineScaleSetSku(input *compute.Sku) (*string, error) {
var skuName string
if input != nil && input.Name != nil {
if strings.HasPrefix(strings.ToLower(*input.Name), "standard") {
skuName = *input.Name
} else {
skuName = fmt.Sprintf("Standard_%s", *input.Name)
}

return &skuName, nil
}

return nil, fmt.Errorf("Sku struct 'name' is nil")
}

func ValidateOrchestratedVirtualMachineScaleSetSku(input interface{}, key string) (warnings []string, errors []error) {
v, ok := input.(string)
if !ok {
errors = append(errors, fmt.Errorf("expected %q to be a string", key))
return
}

skuParts := strings.Split(v, "_")

if len(skuParts) < 2 || strings.Contains(v, "__") || strings.Contains(v, " ") {
errors = append(errors, fmt.Errorf("%q(%q) is not formatted properly.", key, v))
}

return
}
13 changes: 7 additions & 6 deletions internal/acceptance/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/provider"
)

// lintignore:AT001
func (td TestData) DataSourceTest(t *testing.T, steps []TestStep) {
// DataSources don't need a check destroy - however since this is a wrapper function
// and not matching the ignore pattern `XXX_data_source_test.go`, this needs to be explicitly opted out

// lintignore:AT001
testCase := resource.TestCase{
PreCheck: func() { PreCheck(t) },
Steps: steps,
}
td.runAcceptanceTest(t, testCase)
}

// lintignore:AT001
func (td TestData) DataSourceTestInSequence(t *testing.T, steps []TestStep) {
// DataSources don't need a check destroy - however since this is a wrapper function
// and not matching the ignore pattern `XXX_data_source_test.go`, this needs to be explicitly opted out

// lintignore:AT001
testCase := resource.TestCase{
PreCheck: func() { PreCheck(t) },
Steps: steps,
Expand All @@ -36,7 +38,6 @@ func (td TestData) DataSourceTestInSequence(t *testing.T, steps []TestStep) {
td.runAcceptanceSequentialTest(t, testCase)
}

// lintignore:AT001
func (td TestData) ResourceTest(t *testing.T, testResource types.TestResource, steps []TestStep) {
testCase := resource.TestCase{
PreCheck: func() { PreCheck(t) },
Expand All @@ -54,17 +55,17 @@ func (td TestData) ResourceTest(t *testing.T, testResource types.TestResource, s

// ResourceTestIgnoreCheckDestroyed skips the check to confirm the resource test has been destroyed.
// This is done because certain resources can't actually be deleted.
// lintignore:AT001
func (td TestData) ResourceTestSkipCheckDestroyed(t *testing.T, steps []TestStep) {
// lintignore:AT001
testCase := resource.TestCase{
PreCheck: func() { PreCheck(t) },
Steps: steps,
}
td.runAcceptanceTest(t, testCase)
}

// lintignore:AT001
func (td TestData) ResourceSequentialTestSkipCheckDestroyed(t *testing.T, steps []TestStep) {
// lintignore:AT001
testCase := resource.TestCase{
PreCheck: func() { PreCheck(t) },
Steps: steps,
Expand Down Expand Up @@ -132,7 +133,7 @@ func (td TestData) providers() map[string]func() (*schema.Provider, error) {
func (td TestData) externalProviders() map[string]resource.ExternalProvider {
return map[string]resource.ExternalProvider{
"azuread": {
VersionConstraint: "=1.5.1",
VersionConstraint: "=2.8.0",
Source: "registry.terraform.io/hashicorp/azuread",
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ func resourceApiManagementApiOperationPolicy() *pluginsdk.Resource {
Read: resourceApiManagementAPIOperationPolicyRead,
Update: resourceApiManagementAPIOperationPolicyCreateUpdate,
Delete: resourceApiManagementAPIOperationPolicyDelete,
// TODO: replace this with an importer which validates the ID during import
Importer: pluginsdk.DefaultImporter(),
Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error {
_, err := parse.ApiOperationPolicyID(id)
return err
}),

Timeouts: &pluginsdk.ResourceTimeout{
Create: pluginsdk.DefaultTimeout(30 * time.Minute),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"

"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2020-12-01/apimanagement"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"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/apimanagement/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/utils"
)
Expand Down Expand Up @@ -94,18 +94,14 @@ func TestAccApiManagementAPIOperationPolicy_rawXml(t *testing.T) {
}

func (ApiManagementApiOperationPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := azure.ParseAzureResourceID(state.ID)
id, err := parse.ApiOperationPolicyID(state.ID)
if err != nil {
return nil, err
}
resourceGroup := id.ResourceGroup
serviceName := id.Path["service"]
apiName := id.Path["apis"]
operationID := id.Path["operations"]

resp, err := clients.ApiManagement.ApiOperationPoliciesClient.Get(ctx, resourceGroup, serviceName, apiName, operationID, apimanagement.PolicyExportFormatXML)
resp, err := clients.ApiManagement.ApiOperationPoliciesClient.Get(ctx, id.ResourceGroup, id.ServiceName, id.ApiName, id.OperationName, apimanagement.PolicyExportFormatXML)
if err != nil {
return nil, fmt.Errorf("reading ApiManagementApi Operation Policy (%s): %+v", id, err)
return nil, fmt.Errorf("reading %s: %+v", *id, err)
}

return utils.Bool(resp.ID != nil), nil
Expand Down
Loading

0 comments on commit baa8d11

Please sign in to comment.