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

r/resource_group_template_deployment: checking for the resource name insensitively #10565

Merged
merged 1 commit into from
Feb 15, 2021

Conversation

tombuildsstuff
Copy link
Contributor

Fixes #10439

Before this change:

$ TF_ACC=1 envchain azurerm go test -v ./azurerm/internal/services/resource/... -run=TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing -timeout=60m -mod=vendor
=== RUN   TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== PAUSE TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== CONT  TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
   testing.go:766: Error destroying resource! WARNING: Dangling resources
       may exist. The full state and error is shown below.

       Error: errors during apply: removing items provisioned by this Template Deployment: determining API Versions for Resource Providers: unable to determine API version for Resource Type "actionGroups" (Resource Provider "microsoft.insights")

       State: azurerm_resource_group.test:
         ID = /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestrg-210212135344425112
         provider = provider.azurerm
         location = westeurope
         name = acctestrg-210212135344425112
         tags.% = 0
       azurerm_resource_group_template_deployment.test:
         ID = /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestrg-210212135344425112/providers/Microsoft.Resources/deployments/acctest
         provider = provider.azurerm
         debug_level =
         deployment_mode = Complete
         name = acctest
         output_content = {}
         parameters_content = {"someParam":{"value":"first"}}
         resource_group_name = acctestrg-210212135344425112
         tags.% = 0
         template_content = {"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{"someParam":{"allowedValues":["first","second","third"],"type":"String"}},"resources":[{"apiVersion":"2019-06-01","dependsOn":[],"location":"Global","name":"acctestTemplateDeployAG-210212135344425112","properties":{"emailReceivers":[{"emailAddress":"[email protected]","name":"Rick Sanchez"}],"enabled":true,"groupShortName":"rick-c137","smsReceivers":[],"webhookReceivers":[]},"tags":{},"type":"microsoft.insights/actionGroups"}],"variables":{}}
--- FAIL: TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing (128.13s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource	129.826s
?   	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/client	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/parse	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/validate	(cached) [no tests to run]
FAIL

After this change:

$ TF_ACC=1 envchain azurerm go test -v ./azurerm/internal/services/resource/... -run=TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing -timeout=60m -mod=vendor
=== RUN   TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== PAUSE TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== CONT  TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
--- PASS: TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing (193.09s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource	194.774s
?   	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/client	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/parse	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/validate	(cached) [no tests to run]

…insensitively

Fixes #10439

Before this change:

```
$ TF_ACC=1 envchain azurerm go test -v ./azurerm/internal/services/resource/... -run=TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing -timeout=60m -mod=vendor
=== RUN   TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== PAUSE TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== CONT  TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
   testing.go:766: Error destroying resource! WARNING: Dangling resources
       may exist. The full state and error is shown below.

       Error: errors during apply: removing items provisioned by this Template Deployment: determining API Versions for Resource Providers: unable to determine API version for Resource Type "actionGroups" (Resource Provider "microsoft.insights")

       State: azurerm_resource_group.test:
         ID = /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestrg-210212135344425112
         provider = provider.azurerm
         location = westeurope
         name = acctestrg-210212135344425112
         tags.% = 0
       azurerm_resource_group_template_deployment.test:
         ID = /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestrg-210212135344425112/providers/Microsoft.Resources/deployments/acctest
         provider = provider.azurerm
         debug_level =
         deployment_mode = Complete
         name = acctest
         output_content = {}
         parameters_content = {"someParam":{"value":"first"}}
         resource_group_name = acctestrg-210212135344425112
         tags.% = 0
         template_content = {"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{"someParam":{"allowedValues":["first","second","third"],"type":"String"}},"resources":[{"apiVersion":"2019-06-01","dependsOn":[],"location":"Global","name":"acctestTemplateDeployAG-210212135344425112","properties":{"emailReceivers":[{"emailAddress":"[email protected]","name":"Rick Sanchez"}],"enabled":true,"groupShortName":"rick-c137","smsReceivers":[],"webhookReceivers":[]},"tags":{},"type":"microsoft.insights/actionGroups"}],"variables":{}}
--- FAIL: TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing (128.13s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource	129.826s
?   	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/client	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/parse	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/validate	(cached) [no tests to run]
FAIL
```

After this change:

```
$ TF_ACC=1 envchain azurerm go test -v ./azurerm/internal/services/resource/... -run=TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing -timeout=60m -mod=vendor
=== RUN   TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== PAUSE TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
=== CONT  TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing
--- PASS: TestAccResourceGroupTemplateDeployment_singleItemIncorrectCasing (193.09s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource	194.774s
?   	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/client	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/parse	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/resource/validate	(cached) [no tests to run]
```
@tombuildsstuff tombuildsstuff added this to the v2.48.0 milestone Feb 12, 2021
@tombuildsstuff tombuildsstuff requested a review from a team February 12, 2021 12:59
@ghost ghost added the size/M label Feb 12, 2021
Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@tombuildsstuff tombuildsstuff merged commit 911cdc8 into master Feb 15, 2021
@tombuildsstuff tombuildsstuff deleted the b/10439-template-deployment branch February 15, 2021 15:41
tombuildsstuff added a commit that referenced this pull request Feb 15, 2021
@ghost
Copy link

ghost commented Feb 18, 2021

This has been released in version 2.48.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.48.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 18, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants