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

fix error introduced when attached disks are deleted out of band #1301

Merged
merged 2 commits into from
Apr 7, 2018

Conversation

danawillow
Copy link
Contributor

@danawillow danawillow commented Apr 6, 2018

Previously, if a disk was deleted out of band, we would still try to store the same number of disks in state as we previously had, and ParseDiskFieldValue(d.Get(fmt.Sprintf("attached_disk.%d.source", i)).(string), d, config) would throw an error because there was no disk at index i. This makes sure we ignore any supposed disk fields that aren't really there (that occurred as a result of this bug), and fixes the bug by removing nils before we set the attached disks.

Fixes #763.

@danawillow danawillow requested a review from rosbo April 6, 2018 16:50
source, err := ParseDiskFieldValue(d.Get(fmt.Sprintf("attached_disk.%d.source", i)).(string), d, config)
attachedDiskSources := make(map[string]int)
for i, v := range d.Get("attached_disk").([]interface{}) {
if v == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a quick comment about why we need to do this null check here.

@danawillow danawillow merged commit 8ad6f15 into hashicorp:master Apr 7, 2018
@danawillow danawillow deleted the is-763 branch April 7, 2018 00:40
@ghost
Copy link

ghost commented Nov 19, 2018

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 unassigned rosbo Nov 19, 2018
@ghost ghost locked and limited conversation to collaborators Nov 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

State gets corrupt when using attached disks
2 participants