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

azurerm_recovery_services_protection_policy_vm: add timezone property #2404

Merged
merged 2 commits into from
Nov 30, 2018

Conversation

katbyte
Copy link
Collaborator

@katbyte katbyte commented Nov 28, 2018

fixes #2147

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

otherwise LGTM 👍

@@ -217,7 +217,8 @@ func resourceArmRecoveryServicesProtectedVmWaitForState(client backup.ProtectedI

resp, err := state.WaitForState()
if err != nil {
return resp.(backup.ProtectedItemResource), fmt.Errorf("Error waiting for the Recovery Service Protected VM %q to be %t (Resource Group %q) to provision: %+v", protectedItemName, found, resourceGroup, err)
i, _ := resp.(backup.ProtectedItemResource)
Copy link
Contributor

Choose a reason for hiding this comment

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

imo we should be raising this error, since i won't be valid if it's non-nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am raising it as part of the errorf? the cast is done like this because sometimes resp ends up being nil 🤷‍♀️

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, I was referring to the casting error that's a _?

Copy link
Collaborator Author

@katbyte katbyte Nov 30, 2018

Choose a reason for hiding this comment

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

So the reasoning behind this is if resp is nil

i := resp.(backup.ProtectedItemResource)

fails.

however if you use the ok cast, even if its _ for unused

i, _ := resp.(backup.ProtectedItemResource)

the cast doesn't not fail on a nil value and I becomes the zero value for (backup.ProtectedItemResource): https://play.golang.org/p/cDZrRXP6C27

"timezone": {
Type: schema.TypeString,
Optional: true,
Default: "UTC",
Copy link
Contributor

Choose a reason for hiding this comment

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

should we apply some validation to this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would be nice, however I don't know what of the many different timezone formats is valid here (there are at least 2 different sets of valid values it could be, maybe more)

@katbyte
Copy link
Collaborator Author

katbyte commented Nov 30, 2018

Tests pass aside from known failures:
screen shot 2018-11-30 at 10 12 52

@katbyte katbyte merged commit 627b8ad into master Nov 30, 2018
@katbyte katbyte deleted the b-recovery-timezone branch November 30, 2018 18:13
katbyte added a commit that referenced this pull request Nov 30, 2018
metacpp pushed a commit that referenced this pull request Dec 1, 2018
@ghost
Copy link

ghost commented Mar 5, 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 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 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.

Timezone parameter missing on azurerm_recovery_services_protection_policy_vm
2 participants