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/storage_share: switching the state migration over to 0.12 format #3882

Merged
merged 1 commit into from
Jul 19, 2019

Conversation

tombuildsstuff
Copy link
Contributor

The 0.12 SDK uses a different State Migration System to the 0.11 SDK - as such I've ported this over to the new State Migration system (and retroactively included the V0 schema for posterity)

$ go test -v ./azurerm/ -run=TestAzureRMStorageShareMigrateState
=== RUN   TestAzureRMStorageShareMigrateStateV0ToV1
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
--- PASS: TestAzureRMStorageShareMigrateStateV0ToV1 (0.00s)
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzureChinaCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzureGermanCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzurePublicCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzureUSGovernmentCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
=== RUN   TestAzureRMStorageShareMigrateStateV1ToV2
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.chinacloudapi.cn/share1"
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.cloudapi.de/share1"
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.windows.net/share1"
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.usgovcloudapi.net/share1"
--- PASS: TestAzureRMStorageShareMigrateStateV1ToV2 (0.00s)
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzureChinaCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzureGermanCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzurePublicCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzureUSGovernmentCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	0.038s

```
$ go test -v ./azurerm/ -run=TestAzureRMStorageShareMigrateState
=== RUN   TestAzureRMStorageShareMigrateStateV0ToV1
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
2019/07/19 13:33:46 [DEBUG] Updating ID from "share1" to "share1/group1/account1"
--- PASS: TestAzureRMStorageShareMigrateStateV0ToV1 (0.00s)
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzureChinaCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzureGermanCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzurePublicCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:20: [DEBUG] Testing with Cloud "AzureUSGovernmentCloud"
    resource_arm_storage_share_migration_test.go:49: [DEBUG] Ok!
=== RUN   TestAzureRMStorageShareMigrateStateV1ToV2
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.chinacloudapi.cn/share1"
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.cloudapi.de/share1"
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.windows.net/share1"
2019/07/19 13:33:46 [DEBUG] Updating Resource ID from "share1/group1/account1" to "https://account1.file.core.usgovcloudapi.net/share1"
--- PASS: TestAzureRMStorageShareMigrateStateV1ToV2 (0.00s)
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzureChinaCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzureGermanCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzurePublicCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
    resource_arm_storage_share_migration_test.go:62: [DEBUG] Testing with Cloud "AzureUSGovernmentCloud"
    resource_arm_storage_share_migration_test.go:91: [DEBUG] Ok!
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	0.038s
```
@tombuildsstuff tombuildsstuff added this to the v1.32.0 milestone Jul 19, 2019
@tombuildsstuff tombuildsstuff requested review from bflad and a team July 19, 2019 11:53
@ghost ghost added the size/L label Jul 19, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

This looks good to me! 🚀

Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateArmStorageShareName,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I believe you can remove extraneous elements like ValidateFunc, ForceNew, Required, etc. from these old schema definitions since the state upgraders only need the type information, but either which way though!

@tombuildsstuff tombuildsstuff merged commit 76fe4d7 into master Jul 19, 2019
@tombuildsstuff tombuildsstuff deleted the f/storage-state-migration branch July 19, 2019 18:05
@ghost
Copy link

ghost commented Jul 30, 2019

This has been released in version 1.32.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 = "~> 1.32.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Aug 19, 2019

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 19, 2019
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