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

provider/azurerm: catch azurerm_template_deployment errors #7644

Merged
merged 1 commit into from
Jul 14, 2016

Conversation

pmcatominey
Copy link
Contributor

The error was ignored causing Terraform to report that the deployments was
successful rather than in a bad state. This commit cause the apply operation
to report the error.

Added a test which attempts to create a storage account with a name longer
than the maximum permitted length to force a failure.

TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMTemplateDeployment_ -timeout 120m
=== RUN   TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (377.78s)
=== RUN   TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (327.89s)
=== RUN   TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (226.64s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm    932.440s

The error was ignored causing Terraform to report that the deployments was
successful rather than in a bad state. This commit cause the apply operation
to report the error.

Added a test which attempts to create a storage account with a name longer
than the maximum permitted length to force a failure.

```
TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMTemplateDeployment_ -timeout 120m
=== RUN   TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (377.78s)
=== RUN   TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (327.89s)
=== RUN   TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (226.64s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/azurerm	932.440s
```
@pmcatominey
Copy link
Contributor Author

I looked at the history of the file and couldn't find a reason for why the error wasn't being passed by up the chain.

The error reported is now:

* azurerm_template_deployment.test: Error creating deployment: resources.DeploymentsClient#CreateOrUpdate: Failure sending request: StatusCode=200 -- Original Error: Long running operation terminated with status 'Failed': Code="DeploymentFailedCleanUp" Message="The deployment operation failed, because it was unable to cleanup. Please see https://aka.ms/arm-debug for usage details."

which isn't the best but at least indicates that the deployment failed.

@stack72
Copy link
Contributor

stack72 commented Jul 14, 2016

Thanks for the work here @pmcatominey

You are opening them faster than I can close them :)

will run the tests once I am finished running a set on VMs

Paul

@stack72
Copy link
Contributor

stack72 commented Jul 14, 2016

The tests look good sir! Thanks so much - great catch :)

% make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMTemplateDeployment_'              1 ↵
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMTemplateDeployment_ -timeout 120m
=== RUN   TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (293.51s)
=== RUN   TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (298.74s)
=== RUN   TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (191.99s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm    784.261s

@stack72 stack72 merged commit 0fde61b into hashicorp:master Jul 14, 2016
@pmcatominey pmcatominey deleted the arm-template-errors branch July 14, 2016 15:16
iceycake pushed a commit to ticketmaster/terraform that referenced this pull request Jul 22, 2016
…#7644)

The error was ignored causing Terraform to report that the deployments was
successful rather than in a bad state. This commit cause the apply operation
to report the error.

Added a test which attempts to create a storage account with a name longer
than the maximum permitted length to force a failure.

```
TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMTemplateDeployment_ -timeout 120m
=== RUN   TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (377.78s)
=== RUN   TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (327.89s)
=== RUN   TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (226.64s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/azurerm	932.440s
```
@ghost
Copy link

ghost commented Apr 24, 2020

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants