Design application templates

Administrators create application templates to help ensure that their preferred architecture is used by each development team. This helps you govern the resources and configurations that developers use in their application deployments.

Once you create an application template, others in your space can access it. You can also add a template to a catalog to share with other spaces.

Developers can use your template to create and deploy an application. When developers create an application, they can configure each component from the template, but they can't add or remove any components. The template generates Terraform code, which developers can download or deploy from App Design Center.

This document helps you design, configure, and share an application template using App Design Center.

Before you begin

You must have one of the following roles on the app-enabled folder or management project:

  • Application Design Center Admin (roles/designcenter.admin)
  • Application Design Center User (roles/designcenter.user)

Create an application template

Create application templates to share your architecture design with development teams. You can add the following components to your template design:

  • Assets: High-level resources that help you control other resources. For example, service accounts.

  • Services: Network or API interfaces that are consumed over the network. Examples include Cloud Storage and Vertex AI.

  • Workloads: Binary deployments that perform business functions. Examples include Cloud Run and Compute Engine.

You can select from the following components:

As you design your template, App Design Center generates Terraform code to reflect the design and configuration details.

Specify template details

Template details help you categorize your template and help developers decide whether to use your template.

To enter details for your template, do the following:

Design canvas

  1. From the navigation menu, click Templates.

    Go to Templates

  2. Click Create template.

  3. In the Template ID field, enter a unique identifier for the template. This field is required.

  4. In the Template Name field, enter a human-readable identifier to display in the Google Cloud console.

    If you don't provide a name, the Template ID is copied to this field.

  5. In the Description field, enter a brief explanation of the application's purpose.

  6. Click Create template. The design canvas is displayed.

gcloud CLI

Create a new application template.

gcloud design-center spaces application-templates create APPLICATION_TEMPLATE \
--project=PROJECT \
--location=LOCATION \
--space=SPACE \
--display-name=DISPLAY_NAME \
--description=DESCRIPTION

Replace the following:

  • APPLICATION_TEMPLATE: The template ID for the application template that you want to create.
  • PROJECT: Your management project ID.
  • LOCATION: The application template region.
  • SPACE: Your space ID.
  • DISPLAY_NAME: A name to display in the Google Cloud console.
  • DESCRIPTION: A brief description.

For more information, see gcloud design-center spaces application-templates create.

Design your template

Design your template by adding and connecting components on the design canvas. The following example includes three connected components.

A three-tier web application in the design canvas. The application includes frontend, backend, and database components.

You can design your template by adding components to the following starting points:

To design your template, do the following:

Design canvas

  1. From the design canvas, make sure Design is selected.

  2. Do one of the following to get started:

    • To start from scratch, from the Components area, click a component to add it to the canvas area.

    • To start from a Google-provided template, click the template name.

    • To use natural language chat to generate a template, click Custom Application with Gemini.

  3. To create a communication channel between components, do one of the following:

    • To connect two components on the canvas, drag from a blue dot on a component to a blue dot on another component.

    • To add to an existing component, click Add and select the component to add.

    For connection details, see the configuration documentation for each supported resource.

  4. To remove a component or connection, do the following:

    1. In the canvas, click the component or connection.

    2. In the Configuration area, click Delete.

    3. In the field, enter delete.

    4. Click Delete.

gcloud CLI

  1. Identify the template revision URIs for the Google catalog components that you want to add to the template.

    gcloud design-center spaces shared-templates list \
    --google-catalog \
    --location=us-central1
    

    For more information, see gcloud design-center spaces shared-templates list.

  2. Add a component to your application template.

    gcloud design-center spaces application-templates components create COMPONENT \
    --project=PROJECT \
    --location=LOCATION \
    --space=SPACE \
    --application-template=APPLICATION_TEMPLATE \
    --shared-template-revision-uri=SHARED_TEMPLATE_URI
    

    Replace the following:

    • COMPONENT: The component ID for the component that you want to add to the template.
    • PROJECT: Your management project ID.
    • LOCATION: The application template region.
    • SPACE: Your space ID.
    • APPLICATION_TEMPLATE: The template ID for the application template where you're adding the component.
    • SHARED_TEMPLATE_URI: The component shared template URI. For example, projects/my-project/locations/us-central1/spaces/my-space/sharedTemplates/my-shared-template/revisions/rev1.

    For more information, see gcloud design-center spaces application-templates components create.

  3. Add a second component to your template.

    gcloud design-center spaces application-templates components create COMPONENT_2 \
    --project=PROJECT \
    --location=LOCATION \
    --space=SPACE \
    --application-template=APPLICATION_TEMPLATE \
    --shared-template-revision-uri=SHARED_TEMPLATE_URI_2
    

    Replace the following:

    • COMPONENT_2: The component ID for the second component that you want to add to the template.
    • PROJECT: Your management project ID.
    • LOCATION: The application template region.
    • SPACE: Your space ID.
    • APPLICATION_TEMPLATE: The template ID for the application template where you're adding the component.
    • SHARED_TEMPLATE_URI_2: The second component shared template URI. For example, projects/my-project/locations/us-central1/spaces/my-space/sharedTemplates/my-shared-template/revisions/rev1.

    For more information, see gcloud design-center spaces application-templates components create.

  4. Create a connection between the two components.

    gcloud design-center spaces application-templates components connections create CONNECTION \
    --project=PROJECT \
    --location=LOCATION \
    --space=SPACE \
    --application-template=APPLICATION_TEMPLATE \
    --component=COMPONENT \
    --destination-component-uri=COMPONENT_2
    

    Replace the following:

    • CONNECTION: The connection ID for the connection that you want to add to the template.
    • PROJECT: Your management project ID.
    • LOCATION: The application template region.
    • SPACE: Your space ID.
    • APPLICATION_TEMPLATE: The template ID for the application template where you're adding the connection.
    • COMPONENT: The source component ID.
    • COMPONENT_2: The destination component ID.

    For more information, see gcloud design-center spaces application-templates components connections create.

Configure default values for components

For each component that you add to the canvas, you can specify configuration details such as the project where the resource is created, and the location where it's deployed. If you specify configuration details, Application Design Center uses them as default values for applications.

You can also modify connection details if the default configuration doesn't meet your requirements. For example, you might modify environment variable key names, change connection ports, or add additional roles to service accounts.

Before developers deploy an application, they can view and modify the default values you configured in the template. Developers must configure the required details for each supported resource.

To configure components and connections, do the following:

Design canvas

  1. From the design canvas, click a component.

  2. In the Configuration area, from the Project ID list, select the project where you want to deploy the resource. Select a project with the following qualifications:

  3. Configure additional settings for the resource. For example, for Cloud SQL, you might configure the following:

    • Region
    • Backup configuration
    • Database flags
    • IP configuration

    For links to configuration documentation for each component, see Supported resources.

  4. When you connect components on the design canvas, default configuration values are used to create the connection. To add or modify connection details, do the following.

    1. In the design canvas, click the connection between two components. The Connection panel opens and displays connection parameters.

    2. Do one of the following:

      • To modify an existing connection parameter, click Edit.

      • To add a new connection parameter, click Add parameter.

    3. Update the Key and Value fields. For example, you might want to modify the following details:

      • The environment variable key names to align with your application requirements.
      • The connection port value.
      • The roles added to a service account.
  5. Click Save.

gcloud CLI

  1. Describe each component in the application template to view component parameters.

     gcloud design-center spaces application-templates components describe COMPONENT \
     --project=PROJECT \
     --location=LOCATION \
     --space=SPACE \
     --application-template=APPLICATION_TEMPLATE
    

    Replace the following:

    • COMPONENT: The component ID for the component that you want to describe.
    • PROJECT: Your management project ID.
    • LOCATION: The application template region.
    • SPACE: Your space ID.
    • APPLICATION_TEMPLATE: The template ID for the application template.

    For more information, see gcloud design-center spaces application-templates components describe.

  2. For each component that you want to modify, in your home directory, create a JSON file that contains parameter values.

    For example, you might create the following file for a Cloud Run component:

      [
          {
            "key": "service_name",
            "value": "frontend-service"
          },
          {
            "key": "project_id",
            "value": "DEPLOYMENT_PROJECT"
          }
      ]
    
  3. Update each component in the application template to configure the required parameters.

     gcloud design-center spaces application-templates components update COMPONENT \
     --project=PROJECT \
     --location=LOCATION \
     --space=SPACE \
     --parameters=PARAMETERS_FILE_PATH_1 \
     --application-template=APPLICATION_TEMPLATE
    

    Replace the following:

    • COMPONENT: The component ID for the component that you want to update.
    • PROJECT: Your management project ID.
    • LOCATION: The application template region.
    • SPACE: Your space ID.
    • PARAMETERS_FILE_PATH_1: A JSON file that includes component parameters.
    • APPLICATION_TEMPLATE: The template ID for the application template.

    For more information, see gcloud design-center spaces application-templates components update.

  4. Describe the component connections.

     gcloud design-center spaces application-templates components connections describe CONNECTION \
     --component=COMPONENT \
     --application-template=APPLICATION_TEMPLATE \
     --project=PROJECT \
     --location=LOCATION \
     --space=SPACE
    

    Replace the following:

    • CONNECTION: The connection ID.
    • COMPONENT: The component ID.
    • APPLICATION_TEMPLATE: The template ID.
    • PROJECT: Your management project ID.
    • LOCATION: The application template region.
    • SPACE: Your space ID.

    For more information, see gcloud design-center spaces application-templates components connections describe.

  5. Edit component connection parameters.

     gcloud design-center spaces application-templates components connections update CONNECTION \
     --component=COMPONENT \
     --application-template=APPLICATION_TEMPLATE \
     --project=PROJECT \
     --location=LOCATION \
     --space=SPACE \
     --source-component-parameters='[{"key": SOURCE_KEY, "value": SOURCE_VALUE}]'
    

    Replace the following:

    • CONNECTION: The connection ID.
    • COMPONENT: The component ID.
    • APPLICATION_TEMPLATE: The template ID.
    • PROJECT: Your management project ID.
    • LOCATION: The application template region.
    • SPACE: Your space ID.
    • SOURCE_KEY: The new parameter key.
    • SOURCE_VALUE: The new parameter value.

    For more information, see gcloud design-center spaces application-templates components connections update.

Edit Terraform code

As you design your application template, Application Design Center generates Terraform code to reflect the design and configuration details. You can edit the Terraform to specify component configuration details.

The system generates the following Terraform files:

  • main.tf: Infrastructure code that includes a module for each component in the template.
  • outputs.tf: Exposes information about infrastructure components that are deployed.
  • variables.tf: Declares name, type, and description for variables used in the main.tf file.
  • input.tfvars: Defines values for variables used in the main.tf file.
  • providers.tf: Defines labels that help Terraform interact with Google Cloud APIs and resources.

For background information, see Overview of Terraform on Google Cloud.

To edit the Terraform code, do the following:

  1. From the design canvas, click Code. The system displays the generated Terraform files.

  2. Click main.tf. The system displays the Terraform module for each component.

  3. Edit configuration details. For more information, see the configuration documentation for each supported resource.

    The system automatically validates your edits, and displays errors if your edits are invalid.

  4. To highlight and compare your edits, do the following:

    1. Click View diff.

    2. To revert a change, in the margin, click Click to revert change.

    3. Click View diff to close the comparison view.

  5. To save your edits, click Save code changes.

  6. To verify your changes, do the following.

    1. Click Design.
    2. Click a component and review its configuration details.

Delete a template

If you no longer need a template, you can delete it.

Design canvas

  1. From the design canvas, click Actions.
  2. Click Delete.

gcloud CLI

Delete an application template.

```sh
gcloud design-center spaces application-templates delete APPLICATION_TEMPLATE \
--project=PROJECT \
--location=LOCATION \
--space=SPACE
```

Replace the following:

  • APPLICATION_TEMPLATE: The template ID for the application template that you want to delete.
  • PROJECT: Your management project ID.
  • LOCATION: The application template region.
  • SPACE: Your space ID.

For more information, see gcloud design-center spaces application-templates delete.

Verify your template

Before you share your template with developers, make sure that it functions as you intended. To verify your template, do the following:

  1. Create an application with the following settings:
    1. From the Environment list, select TEST.
    2. From the Criticality list, select LOW.
  2. Deploy the application. For steps to deploy, see Deploy an application from the console.
  3. Test your infrastructure to make sure that it meets your requirements.
  4. To avoid recurring costs, delete the test deployment.

Share a template to a catalog

Once you have verified your template, you can publish the template to a catalog. The template can be used by application developers who have access to a space where the catalog is shared.

  1. From the design canvas, click Add to Catalog.
  2. To manage spaces where the catalog is shared, see Manage catalogs.

Revise and reshare your template

As you gain experience with your application and your business needs evolve, you might want to update your application template. For example, you might decide to improve performance for a backend service by adding a Memorystore service for caching.

When you modify a template, you create a template revision. To apply your changes to existing applications, developers must deploy applications using the revision.

App Design Center doesn't automatically publish template revisions to catalogs. To share the latest revision, publish the template to the catalog again.

To create a new revision, do the following:

  1. From the navigation menu, click Templates.

    Go to Templates

  2. Select the application template that you want to revise. The canvas opens.

  3. Modify the template to fit your new requirements. For example, add and configure a new component.

  4. To share the latest revision with other spaces, add the template to relevant catalogs again.

What's next