Application Design Center supports several Google Cloud products that you can add as components to your application. To use your own version of these components, or add other components, import your Terraform modules to App Design Center.
Terraform modules are reusable configurations for Google Cloud products. Importing Terraform modules helps you do the following:
- Accelerate and govern application development.
- Reuse your existing design decisions in App Design Center.
- Help application developers adhere to your established design policies.
When you import a Terraform module, App Design Center creates a corresponding component template in your space's catalog. You can then use the template as a component in your application template design.
To learn about Terraform on Google Cloud, see the following:
- Terraform overview.
- Best practices for general style and structure.
- Best practices for reusable modules.
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 |
|---|---|
| Import Terraform modules as custom components | Application Design Center Admin (roles/designcenter.admin), orApplication Design Center User ( roles/designcenter.user) |
For more information about roles, see Access control with IAM.
Configure and import your modules
Complete the following steps to connect to GitHub, create a metadata file, and import a Terraform module.
Connect to your repository using Developer Connect
Create a Developer Connect connection to the GitHub repository where you store your Google Cloud Terraform modules. You'll use this connection when you import.
Create a Developer Connect connection.
For steps, see Connect to GitHub.
Create a Developer Connect repository link.
For steps, see Add repository links to existing connections.
Optional: Prepare your Terraform module metadata
When you import your Terraform module, you can supply your own metadata, or let App Design Center create a metadata file for you.
For example, the following is a metadata.yaml file that you might create for a
service account:
spec:
info:
actuationTool:
flavor: Terraform
version: ">= 1.3"
interfaces: # Optional
variables:
- name: service_account
connections:
- source:
source: github.com/terraform-google/terraform-google-service-accounts
version: ">= 4.4"
spec:
outputExpr: email
requirements:
roles: # Optional after IAM integrations
- level: Project
roles:
- roles/iam.serviceAccountUser
- roles/iap.admin
- roles/run.admin
- roles/iam.serviceAccountAdmin
providerVersions:
- source: hashicorp/google
version: ">= 6, < 7"
- source: hashicorp/google-beta
version: ">= 6, < 7"
ui: # Optional
input:
variables:
ca_root_module:
name: ca_root_module
title: CA Root Module
service_account:
name: service_account
title: Service Account
Import from your repository
You can create an App Design Center component by importing a Terraform module that is based on a single Google Cloud product. If you make changes to your Terraform module in your repository, repeat these steps to import your changes.
To import your Terraform module, do the following:
Identify the catalog where you want to create your component.
gcloud design-center spaces catalogs list \ --project=PROJECT \ --location=LOCATION \ --space=SPACEReplace the following:
PROJECT: Your management project ID.LOCATION: Your location ID.SPACE: Your space ID.
For more information, see gcloud design-center spaces catalogs list.
Create a catalog template in your space's private catalog.
gcloud design-center spaces catalogs templates create COMPONENT_TEMPLATE \ --project=PROJECT \ --catalog=CATALOG \ --location=LOCATION \ --space=SPACE \ --template-category=component-templateReplace the following:
COMPONENT_TEMPLATE: The template ID for the component template that you want to create.PROJECT: Your management project ID.CATALOG: Your catalog ID.LOCATION: Your location ID.SPACE: Your space ID.
For more information, see gcloud design-center spaces catalogs templates create.