When you want to build complex applications from smaller, reusable building blocks, create composite templates. For example, you might create a composite template that includes several connected application templates.
You can also create composite templates to model and package units of deployment for a SaaS offering that you deploy with App Lifecycle Manager. For more information, see Model and package units of deployment.
Design composite templates by adding and connecting standard application templates and individual components. This modular approach lets you do the following:
- Accelerate development: Assemble complex apps from smaller building blocks. You can reuse each standard application template in multiple composite templates.
- Enable parallel development: Enable modular teams to specialize in specific building blocks. For example, a database team can address data storage and analysis with minimal reliance on the application logic team.
- Reduce vulnerability impacts: Developers can update or fix a building block without redeploying the entire application.
- Improve security posture: Restrict access by creating distinct service accounts to deploy each building block. Ensure that each team only has permissions for the building blocks that they configure.
This document shows you how to design, verify, and share a composite template.
Before you begin
To perform the tasks in this document, ask your administrator to grant you the necessary roles on the app-enabled folder or management project, as listed in the following table:
| Task | Required roles |
|---|---|
| Create, design, and edit composite templates | Application Design Center Admin (roles/designcenter.admin), orApplication Design Center User ( roles/designcenter.user) |
| Publish or share composite templates to a catalog | Application Design Center Admin (roles/designcenter.admin) |
For more information about roles, see Access control with IAM.
To use your own standard application templates as building blocks, set input and output variables to establish configurable variables, and create connections between your application templates. For details, see the following:
Create a composite application template
Create composite templates when you want to design and share complex applications. You can add and connect the following in your template design:
Standard application templates: Select from the following existing templates:
- Templates designed by Google, incorporating Google Cloud best practices and default security configurations.
- Templates that you previously created and added to your space's catalog.
Components: Select from the following Google Cloud resources:
- Components designed by Google, incorporating Google Cloud best practices and default security configurations.
- Your own components that you import, based on your own Terraform modules.
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
From the navigation menu, click Templates.
From the Create Template list, select Composite template.
The Template ID field is automatically populated. Alternatively, enter a unique identifier for the template. This field is required.
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.
In the Description field, enter a brief explanation of the application's purpose.
Click Create template. The design canvas is displayed.
gcloud CLI
Create a new composite application template.
gcloud design-center spaces application-templates create APPLICATION_TEMPLATE \
--project=PROJECT \
--location=LOCATION \
--space=SPACE \
--display-name=DISPLAY_NAME \
--description=DESCRIPTION \
--composition-type=COMPOSITE
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 composite template by adding and connecting standard application templates and components to the following starting points:
- A blank canvas.
- A Google-provided template.
- A template that you generate with Gemini assistance.
As you design your template, App Design Center generates Terraform code to reflect the design and configuration details.
To design your template, do the following:
Design canvas
From the design canvas, select Design to view the canvas.
Do one of the following to get started:
To start from a Google-provided template, in the Get Started area on the canvas, click the template name.
To start from a blank canvas, continue to the next step.
To add a standard application template to the canvas, do the following:
In the Components area, click Embed templates.
To add an existing template, click a template in one of the following lists:
- Templates: standard application templates that are in your space's catalog, or have been shared with your space.
- Google templates: standard application templates created by Google and added to the Google catalog.
To add the selected template to the canvas, click Select.
To create a new standard application template, click Create a new template. The Create new template page opens.
For more information, see Design standard application templates.
To add a component to the canvas, from the Components area, click a component.
To create a communication channel between templates and components, do one of the following:
Drag from a blue dot on one building block to a blue dot on another building block.
To add a connected component to an existing component, click Add and select the component to add.
For connection details, see the configuration documentation for each supported resource.
To remove a building block or connection, do the following:
In the canvas, click the building block or connection.
In the Configuration area, click Delete.
In the field, enter delete.
Click Delete.
gcloud CLI
Identify the template revision URIs for the building blocks in your space's catalog.
gcloud design-center spaces shared-templates list \ --project=PROJECT \ --location=LOCATION \ --space=SPACEReplace the following:
PROJECT: Your management project ID.LOCATION: The application template region.SPACE: Your space ID.
For more information, see gcloud design-center spaces shared-templates list.
Identify the template revision URIs for the Google catalog building blocks that you want to add to the template.
gcloud design-center spaces shared-templates list \ --google-catalog \ --location=us-central1For more information, see gcloud design-center spaces shared-templates list.
Add a standard application template or component to your composite 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_URIReplace the following:
COMPONENT: The ID for the standard application template or 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 composite application template where you're adding the standard application template or component.SHARED_TEMPLATE_URI: The standard application template or 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.
Add a second standard application template or 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_2Replace the following:
COMPONENT_2: The ID for the second standard application template or component that you want to add to the template.PROJECT: Your management project ID.