App Lifecycle Manager lets you isolate customer infrastructure, access policies, and quotas in dedicated tenant projects. You can configure producer and tenant projects, create tenant resources to organize deployed units, and pass tenant project variables during provisioning or upgrades.
For an overview of tenants and tenant projects, see Tenants and tenant projects.
Before you begin
Before you create tenant projects or resources:
- Create a Terraform configuration, an Artifact Registry repository, and an artifact containing your SaaS application in your producer project. To learn how to create and upload a blueprint, see Create and upload a blueprint. To learn how to set up a SaaS offering, see Quickstart: Deploy an application with App Lifecycle Manager.
Enable the APIs required by App Lifecycle Manager.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.Verify that the required service accounts are created and that the necessary Identity and Access Management roles are granted in the producer project. This includes the user-created service account and the roles granted to the
service-PROJECT_NUMBER@gcp-sa-saasservicemgmt.iam.gserviceaccount.comservice agent on the producer project, wherePROJECT_NUMBERis the project number of your producer project.
Set up a tenant project
When you provision your tenant's resources into separate projects, your resources, IAM policies, quotas, and network configurations are separated for each of your tenants, making it less likely for breaches or misconfigurations with one tenant to affect your others.
You need the following:
- One producer project
One tenant project for each tenant
Console
To set up tenant and producer projects by using the Google Cloud console:
- Create a producer project and a tenant project for each of your tenants.
- Enable billing on your tenant and producer projects.
Enable the APIs required by App Lifecycle Manager in your tenant projects.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.Verify that your tenant projects have actuation service accounts with the required permissions.
For details, see App Lifecycle Manager service accounts.
After you create and enable billing for your producer and tenant projects, you can create tenant resources and associate units with tenants.
gcloud
To set up producer and tenant projects by using the Google Cloud CLI:
Create your producer project and a tenant project for each of your tenants:
gcloud projects create \ PRODUCER_PROJECT_ID \ --name="SaaS producer project" gcloud projects create \ TENANT_PROJECT_ID \ --name="SaaS tenant A project"Replace the following:
PRODUCER_PROJECT_ID: the producer project IDTENANT_PROJECT_ID: the tenant project ID
Enable billing for your tenant and producer projects:
gcloud billing projects link \ PRODUCER_PROJECT_ID \ --billing-account=BILLING_ACCOUNT_ID gcloud billing projects link \ TENANT_PROJECT_ID \ --billing-account=BILLING_ACCOUNT_IDReplace the following:
BILLING_ACCOUNT_ID: the ID of the billing account that you want to associate with the specified projects
Enable the APIs required by App Lifecycle Manager in your tenant projects:
gcloud services enable \ saasservicemgmt.googleapis.com \ artifactregistry.googleapis.com \ config.googleapis.com \ developerconnect.googleapis.com \ cloudbuild.googleapis.com \ storage.googleapis.com \ --project=TENANT_PROJECT_IDGrant the actuation service account the necessary IAM roles for each tenant project:
gcloud projects add-iam-policy-binding \ TENANT_PROJECT_ID \ --member='serviceAccount:SERVICE_ACCOUNT_ID@PRODUCER_PROJECT_ID.iam.gserviceaccount.com' \ --role=ROLEReplace the following:
SERVICE_ACCOUNT_ID: the ID of the actuation service accountROLE: the IAM role to grant (for example,roles/compute.admin)
Run
gcloud projects add-iam-policy-bindingfor each role that you want to grant to the specified service account.
After you create and enable billing for your producer and tenant projects, you can create tenant resources and associate units with tenants.
Create a tenant resource
Create a tenant resource in your SaaS offering to represent your customer:
In the Google Cloud console, go to App Lifecycle Manager > Tenants.
Click Create.
In the Tenant name field, enter a name for your tenant resource.
Optional: In the Consumer resource field, enter a consumer resource with consumer-defined settings for integration.
In the SaaS offering list, select the SaaS offering that you want to associate your tenant with.
From the Region list, select a region where tenant metadata is stored.
Optional: Click Add label to add a label to your tenant as a key-value pair.
Click Create.
Associate a unit with a tenant
After you create a tenant and deploy a unit, you can link them to each other. This association primarily serves as an organizational tag that helps you organize which units belong to which tenant.
For more information about deploying units, see Deploy a SaaS offering.
To associate a unit with a tenant:
In the Google Cloud console, go to App Lifecycle Manager > Tenants.
Click the name of the tenant that you want to associate with a unit.
Click Edit.
Under Select a unit to be included in the tenant., click Add unit.
In the Unit list, select the unit that you want to associate with this tenant.
Click Done.
Click Save.
The selected units are associated with the indicated tenant.
Provision a new unit with tenant project variables
When you provision a unit associated with a tenant, you must provide the
tenant_project_id and tenant_project_number variables.
In the Google Cloud console, go to App Lifecycle Manager > Units.
Create a new unit associated with your unit kind.
Click Provision.
Select the Release to provision to your tenant unit.
Under Actuation service account, in the Service account list, select the service account that you granted roles to in your tenant project. Follow the principle of least privilege and grant only the necessary roles for the resources being managed.
In the Other input variables section:
- Click Add tenant project variables,
and then select your tenant project to populate the
tenant_project_idandtenant_project_numbervariables. - Optional: Click Add input variable to enter other input variables defined in your Terraform configuration.
- Click Add tenant project variables,
and then select your tenant project to populate the
Click Provision.
App Lifecycle Manager triggers Infrastructure Manager by using the specified
actuation service account. Infrastructure Manager reads the tenant_project_id
and tenant_project_number variables and provisions the Terraform resources
inside that tenant project.
Re-provision a unit with a new release
When you re-provision an existing unit with a new release, you must provide
the tenant_project_id and tenant_project_number variables.
In the Google Cloud console, go to App Lifecycle Manager > Units.
Select the unit associated with your unit kind.
Click Upgrade.
Select the Release that you created with the updated Terraform configuration.
Under Actuation service account, in the Service account list, select the service account that you granted roles to in your tenant project. Follow the principle of least privilege and grant only the necessary roles for the resources being managed.
In the Other input variables section:
- Click Add tenant project variables,
and then select your tenant project to populate the
tenant_project_idandtenant_project_numbervariables. - Optional: Click Add input variable to enter other input variables defined in your Terraform configuration.
- Click Add tenant project variables,
and then select your tenant project to populate the
Click Upgrade.
App Lifecycle Manager triggers Infrastructure Manager by using the specified
actuation service account. Infrastructure Manager reads the tenant_project_id
and tenant_project_number variables and updates the Terraform resources inside
that tenant project.
What's next
- Explore managing dependencies between units.
- Learn more about using variables and variable mapping.
- Review permissions required for service accounts.