lambda_hooks
Creates, updates, deletes or gets a lambda_hook resource or lists lambda_hooks in a region
Overview
| Name | lambda_hooks |
| Type | Resource |
| Description | This is a CloudFormation resource for the first-party AWS::Hooks::LambdaHook. |
| Id | awscc.cloudformation.lambda_hooks |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
lambda_function | string | Amazon Resource Name (ARN), Partial ARN, name, version, or alias of the Lambda function to invoke with this hook. |
hook_status | string | Attribute to specify which stacks this hook applies to or should get invoked for |
target_operations | array | Which operations should this Hook run against? Resource changes, stacks or change sets. |
failure_mode | string | Attribute to specify CloudFormation behavior on hook failure. |
target_filters | object | Attribute to specify which targets should invoke the hook |
stack_filters | object | Filters to allow hooks to target specific stack attributes |
alias | string | The typename alias for the hook. |
hook_arn | string | The Amazon Resource Name (ARN) of the activated hook |
execution_role | string | The execution role ARN assumed by Hooks to invoke Lambda. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
hook_arn | string | The Amazon Resource Name (ARN) of the activated hook |
region | string | AWS region. |
For more information, see AWS::CloudFormation::LambdaHook.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | lambda_hooks | INSERT | LambdaFunction, FailureMode, Alias, ExecutionRole, TargetOperations, HookStatus, region |
delete_resource | lambda_hooks | DELETE | Identifier, region |
update_resource | lambda_hooks | UPDATE | Identifier, PatchDocument, region |
list_resources | lambda_hooks_list_only | SELECT | region |
get_resource | lambda_hooks | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual lambda_hook.
SELECT
region,
lambda_function,
hook_status,
target_operations,
failure_mode,
target_filters,
stack_filters,
alias,
hook_arn,
execution_role
FROM awscc.cloudformation.lambda_hooks
WHERE
region = 'us-east-1' AND
Identifier = '{{ hook_arn }}';
Lists all lambda_hooks in a region.
SELECT
region,
hook_arn
FROM awscc.cloudformation.lambda_hooks_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new lambda_hook resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.cloudformation.lambda_hooks (
LambdaFunction,
HookStatus,
TargetOperations,
FailureMode,
Alias,
ExecutionRole,
region
)
SELECT
'{{ lambda_function }}',
'{{ hook_status }}',
'{{ target_operations }}',
'{{ failure_mode }}',
'{{ alias }}',
'{{ execution_role }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.cloudformation.lambda_hooks (
LambdaFunction,
HookStatus,
TargetOperations,
FailureMode,
TargetFilters,
StackFilters,
Alias,
ExecutionRole,
region
)
SELECT
'{{ lambda_function }}',
'{{ hook_status }}',
'{{ target_operations }}',
'{{ failure_mode }}',
'{{ target_filters }}',
'{{ stack_filters }}',
'{{ alias }}',
'{{ execution_role }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: lambda_hook
props:
- name: lambda_function
value: '{{ lambda_function }}'
- name: hook_status
value: '{{ hook_status }}'
- name: target_operations
value:
- '{{ target_operations[0] }}'
- name: failure_mode
value: '{{ failure_mode }}'
- name: target_filters
value: {}
- name: stack_filters
value:
filtering_criteria: '{{ filtering_criteria }}'
stack_names:
include:
- '{{ include[0] }}'
exclude:
- null
stack_roles:
include:
- '{{ include[0] }}'
exclude:
- null
- name: alias
value: '{{ alias }}'
- name: execution_role
value: '{{ execution_role }}'
UPDATE example
Use the following StackQL query and manifest file to update a lambda_hook resource, using stack-deploy.
/*+ update */
UPDATE awscc.cloudformation.lambda_hooks
SET PatchDocument = string('{{ {
"LambdaFunction": lambda_function,
"HookStatus": hook_status,
"TargetOperations": target_operations,
"FailureMode": failure_mode,
"TargetFilters": target_filters,
"StackFilters": stack_filters,
"ExecutionRole": execution_role
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ hook_arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.cloudformation.lambda_hooks
WHERE
Identifier = '{{ hook_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the lambda_hooks resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
cloudformation:ListTypes,
cloudformation:ActivateType,
cloudformation:BatchDescribeTypeConfigurations,
cloudformation:DescribeType,
cloudformation:SetTypeConfiguration,
iam:PassRole
cloudformation:BatchDescribeTypeConfigurations,
cloudformation:DescribeType
cloudformation:BatchDescribeTypeConfigurations,
cloudformation:DescribeType,
cloudformation:SetTypeConfiguration,
iam:PassRole
cloudformation:BatchDescribeTypeConfigurations,
cloudformation:DeactivateType,
cloudformation:DescribeType,
cloudformation:SetTypeConfiguration
cloudformation:ListTypes,
cloudformation:BatchDescribeTypeConfigurations,
cloudformation:DescribeType