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: Remove storage containers and blobs when storage accounts are not found #6855

Merged
merged 1 commit into from
May 24, 2016

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented May 24, 2016

Fixes #6725

make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMStorageAccount'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMStorageAccount -timeout 120m
=== RUN   TestAccAzureRMStorageAccount_basic
--- PASS: TestAccAzureRMStorageAccount_basic (181.88s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm    181.892s


make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMStorageQueue'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMStorageQueue -timeout 120m
=== RUN   TestAccAzureRMStorageQueue_basic
--- PASS: TestAccAzureRMStorageQueue_basic (158.08s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm    158.094s


make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMStorageBlob'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMStorageBlob -timeout 120m
=== RUN   TestAccAzureRMStorageBlob_basic
--- PASS: TestAccAzureRMStorageBlob_basic (161.40s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm    161.415s


make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMStorageContainer'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMStorageContainer -timeout 120m
=== RUN   TestAccAzureRMStorageContainer_basic
--- PASS: TestAccAzureRMStorageContainer_basic (156.35s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm    156.370s

@stack72 stack72 changed the title provider/azurerm: Remove storage containers and blobs when storage accounts are not found [WIP] provider/azurerm: Remove storage containers and blobs when storage accounts are not found May 24, 2016
@jen20
Copy link
Contributor

jen20 commented May 24, 2016

I don't think there's an easy way of testing this in the acceptance testing framework since it needs manual modification to the underlying infrastructure, correct?

@stack72
Copy link
Contributor Author

stack72 commented May 24, 2016

Correct :) I am going to run the tests to make sure all looks ok though first

@stack72 stack72 force-pushed the b-arm-storage-404 branch from b919fef to 459a118 Compare May 24, 2016 20:40
@stack72
Copy link
Contributor Author

stack72 commented May 24, 2016

This changes this:

Error refreshing state: 1 error(s) occurred:
* azurerm_storage_container.test: Error retrieving keys for storage account "hashicorpaccsaaa": autorest:DoErrorUnlessStatusCode 404 POST https://management.azure.com/subscriptions/34ca515c-4629-458e-bf7c-738d77e0d0ea/resourceGroups/acctestrg/providers/Microsoft.Storage/storageAccounts/hashicorpaccsaaa/listKeys?api-version=2015-06-15 failed with 404 Not Found

to this

terraform plan
Refreshing Terraform state prior to plan...

azurerm_resource_group.test: Refreshing state... (ID: /subscriptions/34ca515c-4629-458e-bf7c-738d77e0d0ea/resourceGroups/acctestrg)
azurerm_storage_account.test: Refreshing state... (ID: /subscriptions/34ca515c-4629-458e-bf7c-738d77e0d0ea/resourceGroups/acctestrg/providers/Microsoft.Storage/storageAccounts/hashicorpaccsaaa)
azurerm_storage_container.test: Refreshing state... (ID: vhds)

The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

+ azurerm_storage_account.test
    account_type:             "Standard_LRS"
    location:                 "northeurope"
    name:                     "hashicorpaccsaaa"
    primary_access_key:       "<computed>"
    primary_blob_endpoint:    "<computed>"
    primary_file_endpoint:    "<computed>"
    primary_location:         "<computed>"
    primary_queue_endpoint:   "<computed>"
    primary_table_endpoint:   "<computed>"
    resource_group_name:      "acctestrg"
    secondary_access_key:     "<computed>"
    secondary_blob_endpoint:  "<computed>"
    secondary_location:       "<computed>"
    secondary_queue_endpoint: "<computed>"
    secondary_table_endpoint: "<computed>"
    tags.#:                   "1"
    tags.environment:         "staging"

+ azurerm_storage_container.test
    container_access_type: "private"
    name:                  "vhds"
    properties.#:          "<computed>"
    resource_group_name:   "acctestrg"
    storage_account_name:  "hashicorpaccsaaa"


@stack72 stack72 changed the title [WIP] provider/azurerm: Remove storage containers and blobs when storage accounts are not found provider/azurerm: Remove storage containers and blobs when storage accounts are not found May 24, 2016
@jen20
Copy link
Contributor

jen20 commented May 24, 2016

We could probably abuse testFunc here to just make API calls to delete the storage account - what do you think?

@stack72 stack72 force-pushed the b-arm-storage-404 branch from 459a118 to bff545b Compare May 24, 2016 21:52
@stack72
Copy link
Contributor Author

stack72 commented May 24, 2016

@jen20 as requested :)

make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMStorageContainer'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMStorageContainer -timeout 120m
=== RUN   TestAccAzureRMStorageContainer_basic
--- PASS: TestAccAzureRMStorageContainer_basic (158.13s)
=== RUN   TestAccAzureRMStorageContainer_disappears
--- PASS: TestAccAzureRMStorageContainer_disappears (147.97s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm    306.112s

@jen20
Copy link
Contributor

jen20 commented May 24, 2016

Great! LGTM pending Travis! Thanks @stack72

@stack72 stack72 merged commit 1d6493f into master May 24, 2016
@stack72 stack72 deleted the b-arm-storage-404 branch May 24, 2016 22:01
@ghost
Copy link

ghost commented Apr 25, 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 25, 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.

azurerm refresh fails when a storage account is missing
2 participants