updateGeneratedTemplate

Updates a generated template. This can be used to change the name, add and remove resources, refresh resources, and change the DeletionPolicy and UpdateReplacePolicy settings. You can check the status of the update to the generated template using the DescribeGeneratedTemplate API action.

Samples

import aws.sdk.kotlin.services.cloudformation.model.ResourceDefinition

fun main() { 
   //sampleStart 
   // This example adds resources to a generated template
val resp = cloudFormationClient.updateGeneratedTemplate {
    generatedTemplateName = "JazzyTemplate"
    addResources = listOf<ResourceDefinition>(
        ResourceDefinition {
            resourceType = "AWS::S3::Bucket"
            resourceIdentifier = mapOf<String, String>(
                "BucketName" to "jazz-bucket"
            )
        },
        ResourceDefinition {
            resourceType = "AWS::EC2::DHCPOptions"
            resourceIdentifier = mapOf<String, String>(
                "DhcpOptionsId" to "random-id123"
            )
        }            
    )
} 
   //sampleEnd
}
import aws.sdk.kotlin.services.cloudformation.model.ResourceDefinition

fun main() { 
   //sampleStart 
   // This example updates a generated template with a new name.
val resp = cloudFormationClient.updateGeneratedTemplate {
    generatedTemplateName = "JazzyTemplate"
    newGeneratedTemplateName = "JazzierTemplate"
} 
   //sampleEnd
}
import aws.sdk.kotlin.services.cloudformation.model.ResourceDefinition

fun main() { 
   //sampleStart 
   // This example removes resources from a generated template
val resp = cloudFormationClient.updateGeneratedTemplate {
    generatedTemplateName = "JazzyTemplate"
    removeResources = listOf<String>(
        "LogicalResourceId1",
        "LogicalResourceId2"
    )
} 
   //sampleEnd
}