Skip to content

Commit 0373c1c

Browse files
committed
more doc changes
1 parent d697967 commit 0373c1c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/utilities/custom_resources.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Inside the methods, implement your custom provisioning logic, and return a `Resp
4545

4646
Custom resources notify cloudformation either of `SUCCESS` or `FAILED` status. You have 2 utility methods to represent these responses: `Response.success(physicalResourceId)` and `Response.failed(physicalResourceId)`.
4747
The `physicalResourceId` is an identifier that is used during the lifecycle operations of the Custom Resource.
48-
You should supply a `physicalResourceId` during the `CREATE` operation, CloudFormation stores the `physicalResourceId` and includes it `UPDATE` and `DELETE` events.
48+
You should generate a `physicalResourceId` during the `CREATE` operation, CloudFormation stores the `physicalResourceId` and includes it `UPDATE` and `DELETE` events.
4949

5050
Here an example of how to implement a Custom Resource using the powertools-cloudformation library:
5151

@@ -167,7 +167,10 @@ with the Fn::GetAtt function.
167167
public class SensitiveDataHandler extends AbstractResourceHandler {
168168
@Override
169169
protected Response create(CloudFormationCustomResourceEvent createEvent, Context context) {
170+
String physicalResourceId = "my-sensitive-resource-" + UUID.randomUUID(); //Create a unique ID
170171
return Response.builder()
172+
.status(Response.Status.SUCCESS)
173+
.physicalResourceId(physicalResourceId)
171174
.value(Map.of("SomeSecret", sensitiveValue))
172175
.noEcho(true)
173176
.build();
@@ -201,8 +204,11 @@ public class CustomSerializationHandler extends AbstractResourceHandler {
201204

202205
@Override
203206
protected Response create(CloudFormationCustomResourceEvent createEvent, Context context) {
207+
String physicalResourceId = "my-policy-name-" + UUID.randomUUID(); //Create a unique ID
204208
Policy policy = new Policy();
205209
return Response.builder()
210+
.status(Response.Status.SUCCESS)
211+
.physicalResourceId(physicalResourceId)
206212
.value(policy)
207213
.objectMapper(policyMapper) // customize serialization
208214
.build();

0 commit comments

Comments
 (0)