:doc:`CloudFormation <../../cloudformation>` / Client / update_generated_template

*************************
update_generated_template
*************************



.. py:method:: CloudFormation.Client.update_generated_template(**kwargs)

  

  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.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateGeneratedTemplate>`_  


  **Request Syntax**
  ::

    response = client.update_generated_template(
        GeneratedTemplateName='string',
        NewGeneratedTemplateName='string',
        AddResources=[
            {
                'ResourceType': 'string',
                'LogicalResourceId': 'string',
                'ResourceIdentifier': {
                    'string': 'string'
                }
            },
        ],
        RemoveResources=[
            'string',
        ],
        RefreshAllResources=True|False,
        TemplateConfiguration={
            'DeletionPolicy': 'DELETE'|'RETAIN',
            'UpdateReplacePolicy': 'DELETE'|'RETAIN'
        }
    )
    
  :type GeneratedTemplateName: string
  :param GeneratedTemplateName: **[REQUIRED]** 

    The name or Amazon Resource Name (ARN) of a generated template.

    

  
  :type NewGeneratedTemplateName: string
  :param NewGeneratedTemplateName: 

    An optional new name to assign to the generated template.

    

  
  :type AddResources: list
  :param AddResources: 

    An optional list of resources to be added to the generated template.

    

  
    - *(dict) --* 

      A resource included in a generated template. This data type is used with the ``CreateGeneratedTemplate`` and ``UpdateGeneratedTemplate`` API actions.

      

    
      - **ResourceType** *(string) --* **[REQUIRED]** 

        The type of the resource, such as ``AWS::DynamoDB::Table``. For the list of supported resources, see `Resource type support for imports and drift detection <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html>`__ in the *CloudFormation User Guide*

        

      
      - **LogicalResourceId** *(string) --* 

        The logical resource id for this resource in the generated template.

        

      
      - **ResourceIdentifier** *(dict) --* **[REQUIRED]** 

        A list of up to 256 key-value pairs that identifies the scanned resource. The key is the name of one of the primary identifiers for the resource. (Primary identifiers are specified in the ``primaryIdentifier`` list in the resource schema.) The value is the value of that primary identifier. For example, for a ``AWS::DynamoDB::Table`` resource, the primary identifiers is ``TableName`` so the key-value pair could be ``"TableName": "MyDDBTable"``. For more information, see `primaryIdentifier <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html#schema-properties-primaryidentifier>`__ in the *CloudFormation Command Line Interface (CLI) User Guide*.

        

      
        - *(string) --* 

        
          - *(string) --* 

          
    
  
    

  :type RemoveResources: list
  :param RemoveResources: 

    A list of logical ids for resources to remove from the generated template.

    

  
    - *(string) --* 

    

  :type RefreshAllResources: boolean
  :param RefreshAllResources: 

    If ``true``, update the resource properties in the generated template with their current live state. This feature is useful when the resource properties in your generated a template does not reflect the live state of the resource properties. This happens when a user update the resource properties after generating a template.

    

  
  :type TemplateConfiguration: dict
  :param TemplateConfiguration: 

    The configuration details of the generated template, including the ``DeletionPolicy`` and ``UpdateReplacePolicy``.

    

  
    - **DeletionPolicy** *(string) --* 

      The ``DeletionPolicy`` assigned to resources in the generated template. Supported values are:

       

      
      * ``DELETE`` - delete all resources when the stack is deleted.
       
      * ``RETAIN`` - retain all resources when the stack is deleted.
      

       

      For more information, see `DeletionPolicy attribute <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html>`__ in the *CloudFormation User Guide*.

      

    
    - **UpdateReplacePolicy** *(string) --* 

      The ``UpdateReplacePolicy`` assigned to resources in the generated template. Supported values are:

       

      
      * ``DELETE`` - delete all resources when the resource is replaced during an update operation.
       
      * ``RETAIN`` - retain all resources when the resource is replaced during an update operation.
      

       

      For more information, see `UpdateReplacePolicy attribute <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html>`__ in the *CloudFormation User Guide*.

      

    
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'GeneratedTemplateId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **GeneratedTemplateId** *(string) --* 

        The Amazon Resource Name (ARN) of the generated template. The format is ``arn:${Partition}:cloudformation:${Region}:${Account}:generatedtemplate/${Id}``. For example, ``arn:aws:cloudformation:us-east-1:123456789012:generatedtemplate/2e8465c1-9a80-43ea-a3a3-4f2d692fe6dc ``.

        
  
  **Exceptions**
  
  *   :py:class:`CloudFormation.Client.exceptions.AlreadyExistsException`

  
  *   :py:class:`CloudFormation.Client.exceptions.GeneratedTemplateNotFoundException`

  
  *   :py:class:`CloudFormation.Client.exceptions.LimitExceededException`

  