You can call this operation to detect drift on individual resources in a stack.

This operation is synchronous. The stack must have been checked for drift.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DetectStackResourceDrift

The operation that you want to perform. Set the value to DetectStackResourceDrift.

LogicalResourceId String Yes ScalingRuleName

The name of the resource.

RegionId String Yes cn-hangzhou

The region ID of the stack. You can call the DescribeRegions operation to query the most recent region list.

StackId String Yes 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of the stack.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Response parameters

Parameter Type Example Description
ActualProperties String {"ScalingRuleName": "test1"}

The actual resource properties in JSON format.

DriftDetectionTime String 2020-02-27T07:47:47

The time at which the resource drift detection operation was initiated.

ExpectedProperties String {"ScalingRuleName": "test2"}

The resource properties as defined in the template, in JSON format.

LogicalResourceId String ScalingRule

The logical ID of the resource as defined in the template.

PhysicalResourceId String asr-2ze4zzc3kf9yz1kd****

The physical ID of the resource.

PropertyDifferences Array

The property differences of the resource.

ActualValue String test1

The actual value of the resource property.

DifferenceType String NOT_EQUAL

The drift type of the resource property. Valid values:

  • ADD: The value has been added to a resource property whose data type is Array or List.
  • REMOVE: The property has been deleted from the current resource configuration.
  • NOT_EQUAL: The current property value differs from the expected value defined in the stack template.
ExpectedValue String test2

The expected value of the resource property as defined in the template.

PropertyPath String /ScalingRuleName

The path of the resource property.

RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6F

The ID of the request.

ResourceDriftStatus String MODIFIED

The resource drift status. Valid values:

  • DELETED: The actual configuration of the resource differs from its expected template configuration because the resource has been deleted.
  • MODIFIED: The actual configuration of the resource differs from its expected template configuration.
  • NOT_CHECKED: Resource Orchestration Service (ROS) has not checked whether the actual configuration of the resource differs from its expected template configuration.
  • IN_SYNC: The actual configuration of the resource matches its expected template configuration.
ResourceType String ALIYUN::ESS::ScalingRule

The resource type.

StackId String 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of the stack.

Examples

Sample requests

http(s)://ros.aliyuncs.com/? Action=DetectStackResourceDrift
&LogicalResourceId=ScalingRuleName
&RegionId=cn-hangzhou
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&<Common request parameters>

Sample success responses

XML format

<DetectStackResourceDriftResponse>
      <ActualProperties>{"ScalingRuleName": "test1"}</ActualProperties>
      <DriftDetectionTime>2020-02-27T07:47:47</DriftDetectionTime>
      <ExpectedProperties>{"ScalingRuleName": "test2"}</ExpectedProperties>
      <LogicalResourceId>ScalingRule</LogicalResourceId>
      <PhysicalResourceId>asr-2ze4zzc3kf9yz1kd****</PhysicalResourceId>
      <PropertyDifferences>
            <ActualValue>test1</ActualValue>
            <DifferenceType>NOT_EQUAL</DifferenceType>
            <ExpectedValue>test2</ExpectedValue>
            <PropertyPath>/ScalingRuleName</PropertyPath>
      </PropertyDifferences>
      <ResourceDriftStatus>MODIFIED</ResourceDriftStatus>
      <ResourceType>ALIYUN::ESS::ScalingRule</ResourceType>
      <StackId>4a6c9851-3b0f-4f5f-b4ca-a14bf691****</StackId>
</DetectStackResourceDriftResponse>

JSON format

{
    "ActualProperties": "{\"ScalingRuleName\": \"test1\"}",
    "DriftDetectionTime": "2020-02-27T07:47:47",
    "ExpectedProperties": "{\"ScalingRuleName\": \"test2\"}",
    "LogicalResourceId": "ScalingRule",
    "PhysicalResourceId": "asr-2ze4zzc3kf9yz1kd****",
    "PropertyDifferences": [
        {
            "ActualValue": "test1",
            "DifferenceType": "NOT_EQUAL",
            "ExpectedValue": "test2",
            "PropertyPath": "/ScalingRuleName"
        }
    ],
    "ResourceDriftStatus": "MODIFIED",
    "ResourceType": "ALIYUN::ESS::ScalingRule",
    "StackId": "4a6c9851-3b0f-4f5f-b4ca-a14bf691****"
}

Error codes

For a list of error codes, visit the API Error Center.

For more information about errors common to all operations, see Common errors.

HTTP status code

Error code

Error message

Description

400

ResourceDriftDetectionProcessing

Drift detection of resource {name} is processing.

The error message returned because the resource drift detection is already in progress. name indicates the resource name.

400

ResourceDriftDetectionFailure

Fail to detect resource {name} drift: {reason}

The error message returned because the resource drift detection fails. name indicates the resource name, and reason indicates the reason.

404

StackNotFound

The Stack ({name}) could not be found.

The error message returned because the specified stack does not exist. name indicates the stack name or ID.

404

ResourceNotFound

The Resource ({name}) could not be found in Stack {stack}.

The error message returned because the specified resource cannot be found in the specified stack. name indicates the resource name, and stack indicates the stack name or ID.