Set up tenant projects and resources

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:

  1. 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.
  2. Enable the APIs required by App Lifecycle Manager.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. 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.

    Enable the APIs

  3. 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.com service agent on the producer project, where PROJECT_NUMBER is 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:

  1. Create a producer project and a tenant project for each of your tenants.
  2. Enable billing on your tenant and producer projects.
  3. 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.enable permission. 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.

    Enable the APIs

  4. 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:

  1. 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 ID
    • TENANT_PROJECT_ID: the tenant project ID
  2. 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_ID
    

    Replace the following:

    • BILLING_ACCOUNT_ID: the ID of the billing account that you want to associate with the specified projects
  3. 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_ID
    
  4. Grant 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=ROLE
    

    Replace the following:

    • SERVICE_ACCOUNT_ID: the ID of the actuation service account
    • ROLE: the IAM role to grant (for example, roles/compute.admin)

    Run gcloud projects add-iam-policy-binding for 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:

  1. In the Google Cloud console, go to App Lifecycle Manager > Tenants.

    Go to Tenants

  2. Click Create.

  3. In the Tenant name field, enter a name for your tenant resource.

  4. Optional: In the Consumer resource field, enter a consumer resource with consumer-defined settings for integration.

  5. In the SaaS offering list, select the SaaS offering that you want to associate your tenant with.

  6. From the Region list, select a region where tenant metadata is stored.

  7. Optional: Click Add label to add a label to your tenant as a key-value pair.

  8. 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:

  1. In the Google Cloud console, go to App Lifecycle Manager > Tenants.

    Go to Tenants

  2. Click the name of the tenant that you want to associate with a unit.

  3. Click Edit.

  4. Under Select a unit to be included in the tenant., click Add unit.

  5. In the Unit list, select the unit that you want to associate with this tenant.

  6. Click Done.

  7. 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.

  1. In the Google Cloud console, go to App Lifecycle Manager > Units.

    Go to Units

  2. Create a new unit associated with your unit kind.

  3. Click Provision.

  4. Select the Release to provision to your tenant unit.

  5. 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.

  6. In the Other input variables section:

    1. Click Add tenant project variables, and then select your tenant project to populate the tenant_project_id and tenant_project_number variables.
    2. Optional: Click Add input variable to enter other input variables defined in your Terraform configuration.
  7. 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.

  1. In the Google Cloud console, go to App Lifecycle Manager > Units.

    Go to Units

  2. Select the unit associated with your unit kind.

  3. Click Upgrade.

  4. Select the Release that you created with the updated Terraform configuration.

  5. 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.

  6. In the Other input variables section:

    1. Click Add tenant project variables, and then select your tenant project to populate the tenant_project_id and tenant_project_number variables.
    2. Optional: Click Add input variable to enter other input variables defined in your Terraform configuration.
  7. 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