aws-cloudformation / cloudformation-coverage-roadmap

The AWS CloudFormation Public Coverage Roadmap
https://aws.amazon.com/cloudformation/
Creative Commons Attribution Share Alike 4.0 International
1.11k stars 56 forks source link

Retrieve only the value from AWS::CloudFormation::WaitCondition in the template. #1740

Open ruchirshetye-aws opened 1 year ago

ruchirshetye-aws commented 1 year ago

Name of the resource

AWS::CloudFormation::WaitCondition

Resource name

No response

Description

As shown below, Currently we can only reference the whole JSON data object from a Wait Condition.

"WaitConditionData" : {
  "Value" : { "Fn::GetAtt" : [ "mywaitcondition", "Data" ]},
  "Description" : "The data passed back as part of signalling the WaitCondition"
},

Below is a sample JSON object which can be received.

{"S3Key":"acbd/pqr.zip"}

But there is no way to only reference the value "acbd/pqr.zip" without the key.

It will be helpful for users if we can also "GetAtt" the value in the key value pair.

Something like as follows:

"WaitConditionData" : {
  "Value" : { "Fn::GetAtt" : [ "mywaitcondition", "Data.S3Key" ]},
  "Description" : "The data passed back as part of signalling the WaitCondition"
},

Other Details

No response

andyRokit commented 1 year ago

This mechanism already exists for SNS Custom resources.

From the documentation [1]

Response

{
   "Status" : "SUCCESS",
   "PhysicalResourceId" : "Tester1",
   "StackId" : "arn:aws:cloudformation:us-west-2:123456789012:stack/stack-name/guid",
   "RequestId" : "unique id for this create request",
   "LogicalResourceId" : "MySeleniumTester",
   "Data" : {
      "resultsPage" : "http://www.myexampledomain/test-results/guid",
      "lastUpdate" : "2012-11-14T03:30Z",
   }
} 

CloudFormation accessing attributes

"Outputs" : {
   "topItem" : {
      "Value" : { "Fn::GetAtt" : ["MySeleniumTest", "resultsPage"] }
   },
   "numRespondents" : {
      "Value" : { "Fn::GetAtt" : ["MySeleniumTest", "lastUpdate"] }
   }
}

This feature request would not only improve functionality, but also consistency.

[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources-sns.html#walkthrough-custom-resources-sns-adding-nonaws-resource