根據我的理解,如果更新依賴的資源,應該更新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