-
Notifications
You must be signed in to change notification settings - Fork 162
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
Power action parameter and method supported #1134
Conversation
// If you want to support more actions, please update powerActionMap simultaneously. | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
"ON", "OFF", "REBOOT", "FORCE-OFF", "FORCE-REBOOT", | ||
}, true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems the ignoreCase shoud be false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case ignore is set false now
@@ -631,6 +639,17 @@ func resourceComputeInstanceV2Create(d *schema.ResourceData, meta interface{}) e | |||
} | |||
} | |||
|
|||
// Create an instance in the shutdown state. | |||
if action, ok := d.GetOk("power_action"); ok { | |||
if action.(string) != "OFF" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FORCE-OFF should also be valid during the creation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, the FORCE-OFF has added
log.Printf("[WARN] The power action (%s) is invalid after instance created", action.(string)) | ||
} else { | ||
if err = doPowerAction(ecsClient, d, action.(string)); err != nil { | ||
return fmt.Errorf("Unable to close the huaweicloud compute instance (%s): %s", d.Id(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the error message shoud be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message has updated.
docs/resources/compute_instance.md
Outdated
@@ -283,6 +283,10 @@ The following arguments are supported: | |||
* `agency_name` - (Optional, String, ForceNew) Specifies the IAM agency name which is created on IAM to provide | |||
temporary credentials for ECS to access cloud services. Changing this creates a new instance. | |||
|
|||
* `power_action` - (Optional, String) Specifies what action needs to be done for the instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifies the power action to be done for ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description has updated, and the note info The power_action is a one-time action.
is better than The power_action parameter specifies a one-time action.
?
What this PR does / why we need it:
Which issue this PR fixes:
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged)fixes #914
fixes #1044
Special notes for your reviewer:
Release note:
PR Checklist
Acceptance Steps Performed