Skip to main content

guard_hooks

Creates, updates, deletes or gets a guard_hook resource or lists guard_hooks in a region

Overview

Nameguard_hooks
TypeResource
DescriptionThis is a CloudFormation resource for activating the first-party AWS::Hooks::GuardHook.
Idawscc.cloudformation.guard_hooks

Fields

NameDatatypeDescription
rule_locationobjectS3 Source Location for the Guard files.
log_bucketstringS3 Bucket where the guard validate report will be uploaded to
hook_statusstringAttribute to specify which stacks this hook applies to or should get invoked for
target_operationsarrayWhich operations should this Hook run against? Resource changes, stacks or change sets.
failure_modestringAttribute to specify CloudFormation behavior on hook failure.
target_filtersobjectAttribute to specify which targets should invoke the hook
stack_filtersobjectFilters to allow hooks to target specific stack attributes
aliasstringThe typename alias for the hook.
hook_arnstringThe Amazon Resource Name (ARN) of the activated hook
execution_rolestringThe execution role ARN assumed by hooks to read Guard rules from S3 and write Guard outputs to S3.
optionsobject
regionstringAWS region.

For more information, see AWS::CloudFormation::GuardHook.

Methods

NameResourceAccessible byRequired Params
create_resourceguard_hooksINSERTRuleLocation, HookStatus, TargetOperations, FailureMode, Alias, ExecutionRole, region
delete_resourceguard_hooksDELETEIdentifier, region
update_resourceguard_hooksUPDATEIdentifier, PatchDocument, region
list_resourcesguard_hooks_list_onlySELECTregion
get_resourceguard_hooksSELECTIdentifier, region

SELECT examples

Gets all properties from an individual guard_hook.

SELECT
region,
rule_location,
log_bucket,
hook_status,
target_operations,
failure_mode,
target_filters,
stack_filters,
alias,
hook_arn,
execution_role,
options
FROM awscc.cloudformation.guard_hooks
WHERE
region = 'us-east-1' AND
Identifier = '{{ hook_arn }}';

INSERT example

Use the following StackQL query and manifest file to create a new guard_hook resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.cloudformation.guard_hooks (
RuleLocation,
HookStatus,
TargetOperations,
FailureMode,
Alias,
ExecutionRole,
region
)
SELECT
'{{ rule_location }}',
'{{ hook_status }}',
'{{ target_operations }}',
'{{ failure_mode }}',
'{{ alias }}',
'{{ execution_role }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a guard_hook resource, using stack-deploy.

/*+ update */
UPDATE awscc.cloudformation.guard_hooks
SET PatchDocument = string('{{ {
"RuleLocation": rule_location,
"LogBucket": log_bucket,
"HookStatus": hook_status,
"TargetOperations": target_operations,
"FailureMode": failure_mode,
"TargetFilters": target_filters,
"StackFilters": stack_filters,
"Options": options
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ hook_arn }}';

DELETE example

/*+ delete */
DELETE FROM awscc.cloudformation.guard_hooks
WHERE
Identifier = '{{ hook_arn }}' AND
region = 'us-east-1';

Permissions

To operate on the guard_hooks resource, the following permissions are required:

cloudformation:ActivateType,
cloudformation:DescribeType,
cloudformation:ListTypes,
cloudformation:SetTypeConfiguration,
cloudformation:BatchDescribeTypeConfigurations,
iam:PassRole