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

WaitForState functions should be a bit more tolerant of http errors. #124

Open
Smithx10 opened this issue Jun 26, 2019 · 0 comments
Open

Comments

@Smithx10
Copy link

Currently during a provision if the client encounters an http issue or returns an error we return err and won't update our state. I discovered this while debugging an issue with AddNIC ( TritonDataCenter/sdc-cloudapi#32 )

I believe the correct behaviour here is to not error out and let the TTL expire if we never reach our desired state. I believe this is currently 10 minutes.

	stateConf := &resource.StateChangeConf{
		Pending: []string{oldName},
		Target:  []string{newName},
		Refresh: func() (interface{}, string, error) {
			inst, err := c.Instances().Get(context.Background(), &compute.GetInstanceInput{
				ID: d.Id(),
			})
			if err != nil {
				return nil, "", err
			}

			return inst, inst.Name, nil
		},
		Timeout:    machineStateChangeTimeout,
		MinTimeout: 3 * time.Second,
	}
	_, err = stateConf.WaitForState()

https://github.com/terraform-providers/terraform-provider-triton/blob/master/triton/resource_machine.go#L556

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant