根据我的理解,如果更新依赖的资源,应该更新DependsOn指定的资源。我看到这是一些资源,但它似乎不适用于自定义资源。DependsOn和Cloudformation自定义资源
我正在使用APIGateway,并尝试使用自定义资源来部署与舞台相关的资源更新时的阶段。这是因为在需要部署更新时,包含的AWS::ApiGateway::Stage
& AWS::ApiGateway::Deployment
似乎不能很好地工作。
我有以下模板(剪断,以供参考):
<snip>
pipelineMgrStateMachine:
Type: AWS::StepFunctions::StateMachine
Properties:
<snip>
webhookEndPointMethod:
Type: AWS::ApiGateway::Method
DependsOn: pipelineMgrStateMachine
Properties:
RestApiId: !Ref pipelineMgrGW
ResourceId: !Ref webhookEndPointResource
HttpMethod: POST
AuthorizationType: NONE
Integration:
Type: AWS
IntegrationHttpMethod: POST
Uri: !Sub arn:aws:apigateway:${AWS::Region}:states:action/StartExecution
Credentials: !GetAtt pipelineMgrGWRole.Arn
PassthroughBehavior: WHEN_NO_TEMPLATES
RequestTemplates:
application/json: !Sub |
{
"input": "$util.escapeJavaScript($input.json('$'))",
"name": "$context.requestId",
"stateMachineArn": "${pipelineMgrStateMachine}"
}
IntegrationResponses:
- StatusCode: 200
MethodResponses:
- StatusCode: 200
pipelineMgrStageDeployer:
Type: Custom::pipelineMgrStageDeployer
DependsOn: webhookEndPointMethod
Properties:
ServiceToken: !GetAtt apiGwStageDeployer.Arn
StageName: pipelinemgr
RestApiId: !Ref pipelineMgrGW
<snip>
当我更新pipelineMgrStateMachine
资源我看到,即使没有在webhookEndPointMethod
改变webhookEndPointMethod
被更新。如预期。
但是,pipelineMgrStageDeployer
未更新。当我使pipelineMgrStageDeployer
直接依赖于pipelineMgrStateMachine
时,情况更是如此。
任何想法为什么自定义资源不会更新资源它DependssOn更新时?任何其他可能有用的想法或见解?
谢谢, 乔
感谢您澄清和参考运作良好! 我很困惑,因为我在DependsOn文档中看到这个注释: _堆栈更新时,依赖更新资源的资源会自动更新。 AWS CloudFormation不会更改自动更新的资源,但是,如果堆栈策略与这些资源相关联,则您的帐户必须有权更新它们。_ 但显然这确实意味着我的意思。 – NimbusScale