Skip to content

detect_stack_set_drift async

detect_stack_set_drift(
    *,
    config_overrides: Optional[AsyncCloudFormationClientConfig] = None,
    stack_set_name: Optional[StackSetNameOrId] = None,
    operation_preferences: Optional[StackSetOperationPreferences] = None,
    operation_id: Optional[ClientRequestToken] = None,
    call_as: Optional[CallAs] = None,
) -> DetectStackSetDriftOutput

Detect drift on a StackSet. When CloudFormation performs drift detection on a StackSet, it performs drift detection on the stack associated with each stack instance in the StackSet. For more information, see Performing drift detection on CloudFormation StackSets.

DetectStackSetDrift returns the OperationId of the StackSet drift detection operation. Use this operation id with DescribeStackSetOperation to monitor the progress of the drift detection operation. The drift detection operation may take some time, depending on the number of stack instances included in the StackSet, in addition to the number of resources included in each stack.

Once the operation has completed, use the following actions to return drift information:

  • Use DescribeStackSet to return detailed information about the stack set, including detailed information about the last completed drift operation performed on the StackSet. (Information about drift operations that are in progress isn't included.)

  • Use ListStackInstances to return a list of stack instances belonging to the StackSet, including the drift status and last drift time checked of each instance.

  • Use DescribeStackInstance to return detailed information about a specific stack instance, including its drift status and last drift time checked.

You can only run a single drift detection operation on a given StackSet at one time.

To stop a drift detection StackSet operation, use StopStackSetOperation.

Parameters:

  • stack_set_name (Optional[StackSetNameOrId], default: None ) –

    The name of the StackSet on which to perform the drift detection operation.

  • operation_preferences (Optional[StackSetOperationPreferences], default: None ) –

    The user-specified preferences for how CloudFormation performs a StackSet operation.

    For more information about maximum concurrent accounts and failure tolerance, see StackSet operation options.

  • operation_id (Optional[ClientRequestToken], default: None ) –

    The ID of the StackSet operation.

  • call_as (Optional[CallAs], default: None ) –

    [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account.

    By default, SELF is specified. Use SELF for StackSets with self-managed permissions.

    • If you are signed in to the management account, specify SELF.

    • If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN.

      Your Amazon Web Services account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the CloudFormation User Guide.

Raises:

Source code in docs_src/capo_cloudformation/_services/async_cloud_formation.py
async def detect_stack_set_drift(
    self,
    *,
    config_overrides: Optional[AsyncCloudFormationClientConfig] = None,
    stack_set_name: Optional[
        "capo_cloudformation.types.stack_set_name_or_id.StackSetNameOrId"
    ] = None,
    operation_preferences: Optional[
        "capo_cloudformation.types.stack_set_operation_preferences.StackSetOperationPreferences"
    ] = None,
    operation_id: Optional[
        "capo_cloudformation.types.client_request_token.ClientRequestToken"
    ] = None,
    call_as: Optional["capo_cloudformation.types.call_as.CallAs"] = None,
) -> "capo_cloudformation.types.detect_stack_set_drift_output.DetectStackSetDriftOutput":
    """<p>Detect drift on a StackSet. When CloudFormation performs drift detection on a StackSet, it performs drift detection on the stack associated with each stack instance in the StackSet. For more information, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-drift.html">Performing drift detection on CloudFormation StackSets</a>.</p> <p> <code>DetectStackSetDrift</code> returns the <code>OperationId</code> of the StackSet drift detection operation. Use this operation id with <a>DescribeStackSetOperation</a> to monitor the progress of the drift detection operation. The drift detection operation may take some time, depending on the number of stack instances included in the StackSet, in addition to the number of resources included in each stack.</p> <p>Once the operation has completed, use the following actions to return drift information:</p> <ul> <li> <p>Use <a>DescribeStackSet</a> to return detailed information about the stack set, including detailed information about the last <i>completed</i> drift operation performed on the StackSet. (Information about drift operations that are in progress isn't included.)</p> </li> <li> <p>Use <a>ListStackInstances</a> to return a list of stack instances belonging to the StackSet, including the drift status and last drift time checked of each instance.</p> </li> <li> <p>Use <a>DescribeStackInstance</a> to return detailed information about a specific stack instance, including its drift status and last drift time checked.</p> </li> </ul> <p>You can only run a single drift detection operation on a given StackSet at one time.</p> <p>To stop a drift detection StackSet operation, use <a>StopStackSetOperation</a>.</p>

    Args:
        stack_set_name: <p>The name of the StackSet on which to perform the drift detection operation.</p>
        operation_preferences: <p>The user-specified preferences for how CloudFormation performs a StackSet operation.</p> <p>For more information about maximum concurrent accounts and failure tolerance, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options">StackSet operation options</a>.</p>
        operation_id: <p> <i>The ID of the StackSet operation.</i> </p>
        call_as: <p>[Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account.</p> <p>By default, <code>SELF</code> is specified. Use <code>SELF</code> for StackSets with self-managed permissions.</p> <ul> <li> <p>If you are signed in to the management account, specify <code>SELF</code>.</p> </li> <li> <p>If you are signed in to a delegated administrator account, specify <code>DELEGATED_ADMIN</code>.</p> <p>Your Amazon Web Services account must be registered as a delegated administrator in the management account. For more information, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html">Register a delegated administrator</a> in the <i>CloudFormation User Guide</i>.</p> </li> </ul>

    Raises:
        capo_cloudformation.errors.invalid_operation_exception.InvalidOperationException: <p>The specified operation isn't valid.</p>
        capo_cloudformation.errors.operation_in_progress_exception.OperationInProgressException: <p>Another operation is currently in progress for this StackSet. Only one operation can be performed for a stack set at a given time.</p>
        capo_cloudformation.errors.stack_set_not_found_exception.StackSetNotFoundException: <p>The specified StackSet doesn't exist.</p>
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudformation.types.detect_stack_set_drift_input.DetectStackSetDriftInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudformation.types.detect_stack_set_drift_output.DetectStackSetDriftOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.detect_stack_set_drift

        (
            output,
            http_response,
        ) = await capo_cloudformation._operations.cloud_formation.detect_stack_set_drift.async_detect_stack_set_drift(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DetectStackSetDrift")
    )
    input_: capo_cloudformation.types.detect_stack_set_drift_input.DetectStackSetDriftInput = {}
    if stack_set_name is not None:
        input_["stack_set_name"] = stack_set_name
    if operation_preferences is not None:
        input_["operation_preferences"] = operation_preferences
    if operation_id is None:
        operation_id = str(uuid.uuid4())
    input_["operation_id"] = operation_id
    if call_as is not None:
        input_["call_as"] = call_as

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output