Obtaining Execution Plans
Function
GetExecutionPlan
This API obtains the details (items) of a specified execution plan. By calling this API, you can check the changes of resources in a stack once the specified execution plan is applied.
If the execution plan is in a CREATION_IN_PROGRESS or CREATION_FAILED state, the list of execution plan items will not be returned.
URI
GET /v1/{project_id}/stacks/{stack_name}/execution-plans/{execution_plan_name}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
A project ID is obtained by calling an API or from the console. Minimum: 3 Maximum: 64 |
stack_name |
Yes |
String |
A stack name is unique within its domain (domain_id), region, and project (project_id). It is case-sensitive and starts with a letter. Only letters, digits, underscores (_), and hyphens (-) are allowed. Minimum: 1 Maximum: 128 |
execution_plan_name |
Yes |
String |
An execution plan name is unique within its domain (domain_id), region, project (project_id), and stack (stack_id). It is case-sensitive and starts with a letter. Only letters, digits, underscores (_), and hyphens (-) are allowed. Minimum: 1 Maximum: 128 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
stack_id |
No |
String |
Unique stack ID. It is a UUID generated by RFS when a stack is created. Stack names are unique at one specific time, so you can create a stack named HelloWorld and another stack with the same name after deleting the first one. For parallel development, team members may want to ensure that they are operating the stack they created, not one with the same name created by other members after deleting the previous one. To avoid this mismatch, check the ID, since RFS ensures each stack has a unique ID that does not change with updates. If the stack_id value differs from the current stack ID, 400 is returned. Minimum: 36 Maximum: 36 |
execution_plan_id |
No |
String |
Unique execution plan ID. A UUID is generated by RFS when an execution plan is created. Execution plan names are unique at one specific time, so you can create an execution plan named HelloWorld and another execution plan with the same name after deleting the first one. For parallel development, team members may want to ensure that they are operating the execution plan they created, not one with the same name created by other members after deleting the previous one. To avoid this mismatch, check the ID, since RFS ensures each execution plan has a unique ID that does not change with updates. If the execution_plan_id value differs from the current execution plan ID, 400 is returned. Minimum: 36 Maximum: 36 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Client-Request-Id |
Yes |
String |
A unique request ID is specified by a user to locate a request. UUID is recommended. Minimum: 36 Maximum: 128 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
execution_plan_items |
Array of ExecutionPlanItem objects |
Item list of an execution plan. |
Parameter |
Type |
Description |
---|---|---|
resource_type |
String |
Resource type. For example, in the following HCL template, the value of resource_type is huaweicloud_vpc. resource "huaweicloud_vpc" "my_hello_world_vpc" { name = "test_vpc" } In a JSON template, the value of resource_type is huaweicloud_vpc. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "name": "test_vpc" } } } } |
resource_name |
String |
Resource name. The default value is the logical name of a resource. For example, in the following HCL template, the value of resource_name is my_hello_world_vpc. resource "huaweicloud_vpc" "my_hello_world_vpc" { name = "test_vpc" } In a JSON template, the value of resource_name is my_hello_world_vpc. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "name": "test_vpc" } } } } |
index |
String |
Resource index. If count or for_each is used in a template, index is returned. If index appears, resource_name and index can be used to identify a resource. If count is used in a template, index is a number starting from 0. For example, in the following HCL template, huaweicloud_vpc.my_hello_world_vpc[0] and huaweicloud_vpc.my_hello_world_vpc[1] identify two resources. resource "huaweicloud_vpc" "my_hello_world_vpc" { count = 2 name = "test_vpc" } In a JSON template, huaweicloud_vpc.my_hello_world_vpc[0] and huaweicloud_vpc.my_hello_world_vpc[1] identify two resources. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "name": "test_vpc", "count": 2 } } } } If for_each is used in a template, index is a user-defined string. For example, in the following HCL template, huaweicloud_vpc.my_hello_world_vpc["vpc1"] and huaweicloud_vpc.my_hello_world_vpc["vpc2"] identify two resources. resource "huaweicloud_vpc" "my_hello_world_vpc" { for_each = { "vpc1" = "test_vpc" "vpc2" = "test_vpc" } name = each.value } In a JSON template, huaweicloud_vpc.my_hello_world_vpc["vpc1"] and huaweicloud_vpc.my_hello_world_vpc["vpc2"] identify two resources. { "resource": { "huaweicloud_vpc": { "my_hello_world_vpc": { "for_each": { "vpc1": "test_vpc", "vpc2": "test_vpc" } "name": "${each.value}" } } } } |
action |
String |
Resource change types may include:
Enumeration values:
|
action_reason |
String |
Reason for triggering project changes, for example, a user updates a template or a resource is deleted remotely. |
provider_name |
String |
Name of the provider to which the project belongs. |
mode |
String |
Resource modes may include:
Enumeration values:
|
drifted |
Boolean |
Whether the change of the current resource is caused by deviation. Deviation, also called drift. After a resource is created by RFS but not modified by RFS, for example, modified manually or by SDK, the resource configuration will be inconsistent with that recorded by RFS. This inconsistency is called deviation. After a resource deviation occurs:
The resource deviation types may include:
Note: It is advised to use RFS to maintain and update resources created on RFS to ensure that resource configurations are consistent with those written in your templates. Avoid modifying resources manually except for emergencies. |
imported |
Boolean |
当前资源的变更是否是导入的。 |
resource_id |
String |
Unique resource physical ID. It is generated by the resource provider, cloud service provider, or other service providers during resource deployment. |
attributes |
Array of ExecutionPlanDiffAttribute objects |
Execution plan item attributes that are changed. If no attribute is changed, this value is an empty list. |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Name of the to-be-modified parameter of the current resource. |
previous_value |
String |
Original value of the modified parameter of the current resource. During resource creation, previous_value is empty. If a deviation occurs in a remote resource, the resource returns two ExecutionPlanItems, the drifted values of which are true and false, respectively.
If no deviation occurs in a remote resource, only one ExecutionPlanItem whose drifted is false is returned.
|
target_value |
String |
Target value of the modified parameter of the current resource. During resource deletion, target_value is empty. If a deviation occurs in a remote resource, the resource returns two ExecutionPlanItems, the drifted values of which are true and false, respectively.
If no deviation occurs in a remote resource, only one ExecutionPlanItem whose drifted is false is returned.
|
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 429
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Response code. Minimum: 11 Maximum: 11 |
error_msg |
String |
Response message. |
encoded_authorization_message |
String |
The message contains information about unauthorized requests. |
Example Requests
-
Obtain the details (items) of a specified execution plan.
GET https://{endpoint}/v1/ba2b9930c977f71edaeaa3a5e96a8ff1/stacks/my_hello_world_stack/execution-plans/my_first_execution_plan
-
Obtain the details (items) of a specified execution plan, with a stack ID and an execution plan ID provided to check whether they match the current stack and execution plan.
GET https://{endpoint}/v1/ba2b9930c977f71edaeaa3a5e96a8ff1/stacks/my_hello_world_stack/execution-plans/my_first_execution_plan?stack_id=ea6a4f0e-ee8a-494e-b12a-8be4a1e65af2&execution_plan_id=fb5e781e-a27d-46e2-9954-242753857a9f
Example Responses
Status code: 200
Execution plan details obtained.
{ "execution_plan_items" : [ { "resource_type" : "huaweicloud_iec_vpc_subnet", "resource_name" : "subnet", "action" : "ADD", "attributes" : [ { "name" : "cidr", "target_value" : "172.16.0.0/16" }, { "name" : "dhcp_enable", "target_value" : "true" }, { "name" : "dns_list", "target_value" : "(will be generated after apply)" }, { "name" : "gateway_ip", "target_value" : "192.168.128.1" }, { "name" : "id", "target_value" : "(will be generated after apply)" }, { "name" : "name", "target_value" : "subnet_demo" }, { "name" : "region" }, { "name" : "site_id", "target_value" : "mock_site_id" }, { "name" : "site_info", "target_value" : "(will be generated after apply)" }, { "name" : "status", "target_value" : "(will be generated after apply)" }, { "name" : "timeouts" }, { "name" : "vpc_id", "target_value" : "mock_vpc_id" } ], "mode" : "RESOURCE", "provider_name" : "huawei.com/provider/huaweicloud" }, { "resource_type" : "huaweicloud_vpc", "resource_name" : "vpc", "action" : "ADD", "attributes" : [ { "name" : "cidr", "target_value" : "172.16.0.0/16" }, { "name" : "description" }, { "name" : "enterprise_project_id", "target_value" : "(will be generated after apply)" }, { "name" : "id", "target_value" : "(will be generated after apply)" }, { "name" : "name", "target_value" : "test_name" }, { "name" : "region", "target_value" : "(will be generated after apply)" }, { "name" : "routes", "target_value" : "(will be generated after apply)" }, { "name" : "secondary_cidr" }, { "name" : "status", "target_value" : "(will be generated after apply)" }, { "name" : "tags" }, { "name" : "timeouts" } ], "mode" : "RESOURCE", "provider_name" : "huawei.com/provider/huaweicloud" } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
Execution plan details obtained. |
400 |
Invalid request. |
401 |
Authentication failed. |
403 |
The user does not have the permission to call this API. |
404 |
|
429 |
Too frequent requests. |
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.