App Hub lets you view your registered applications, update their
attributes, and delete applications so you can keep your application inventory
accurate. To avoid configuration drift, only use App Hub to update or
delete applications that you registered directly, and manage applications based
on templates in Application Design Center.

## Overview

When you [choose your application setup model](https://docs.cloud.google.com/app-hub/docs/set-up-app-hub.md.txt),
you define an [application management boundary](https://docs.cloud.google.com/app-hub/docs/key-concepts.md.txt#app-mgmt-boundary)
for your App Hub applications in a
[management project](https://docs.cloud.google.com/app-hub/docs/key-concepts.md.txt#mgmt-project).
You can then register services and workloads in applications inside this
boundary.

For recommended use cases to introduce application management practices, see
[Prepare for application management](https://docs.cloud.google.com/app-hub/docs/prepare-for-app-lifecycle-management.md.txt).
To create an application and register resources, see
[Register existing resources to an application](https://docs.cloud.google.com/app-hub/docs/register-resources.md.txt).

To avoid configuration drift and maintain a clear source of truth, we recommend
that you manage your application components in the environment where they were
originally defined:

- **For applications deployed from an Application Design Center template** :
  Use Application Design Center to manage and update the application.
  You can either
  [revise the template](https://docs.cloud.google.com/application-design-center/docs/design-application-templates.md.txt#revise_and_reshare_your_template)
  for application design changes or
  [create an application revision](https://docs.cloud.google.com/application-design-center/docs/manage-applications.md.txt#create-application-revision)
  to update settings such as application and component details.

  [Go to Application Design Center](https://console.cloud.google.com/products/design-center/overview)
- **For applications created by registering existing resources in App Hub**:
  Manage applications, services, and workloads directly within App Hub.

  [Go to App Hub](https://console.cloud.google.com/apphub/applications)

In App Hub. you can perform these actions using either the
Google Cloud console or the Google Cloud CLI. For applications deployed from a
[template](https://docs.cloud.google.com/app-hub/docs/key-concepts.md.txt#template), see the
[Application Design Center](https://docs.cloud.google.com/application-design-center/docs/overview.md.txt)
documentation.

## Before you begin

This document assumes you have an application with
[supported resources registered to it](https://docs.cloud.google.com/app-hub/docs/register-resources.md.txt).

### Required roles


To get the permissions that
you need to manage applications in App Hub,

ask your administrator to grant you the
following IAM roles on
the management project that defines your application management boundary
:

- Update and delete applications: [App Hub Editor](https://docs.cloud.google.com/iam/docs/roles-permissions/apphub.md.txt#apphub.editor) (`roles/apphub.editor`)
- View applications: [App Hub Viewer](https://docs.cloud.google.com/iam/docs/roles-permissions/apphub.md.txt#apphub.viewer) (`roles/apphub.viewer`)


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


You might also be able to get
the required permissions through [custom
roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or other [predefined
roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

For more information about App Hub roles, see
[App Hub IAM roles and permissions](https://docs.cloud.google.com/app-hub/docs/roles-permissions.md.txt).

## List applications

Follow these steps to list and filter all the applications within your
application management boundary:

### Console

1. In the Google Cloud console, use the project picker to select your
   management project.

2. Navigate to the **Applications** page from App Hub:


   [Go to Applications](https://console.cloud.google.com/apphub/applications)

   <br />

   The page displays a list of your applications.
3. To filter the list, use the **Filter** field. You can filter by
   attributes such as **Criticality** or **Environment**.

### gcloud

1. [Find the project ID](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#identifying_projects)
   of your management project.

2. Display a list of your applications using one of the following options:

   - List all applications:

     ```bash
     gcloud apphub applications list \
         --project=PROJECT_ID \
         --location=LOCATION
     ```

     Replace the following:
     - `PROJECT_ID`: the ID of your management project.
     - `LOCATION`: the location of your applications. Use `global` for global applications, a multi-region (`us` or `eu`) for multi-regional applications, or a specific region, such as `us-east1`, for regional applications.
   - Filter the list of applications based on attributes, using the
     [`--filter` flag](https://docs.cloud.google.com/sdk/gcloud/reference/topic/filters):

     ```bash
     gcloud apphub applications list \
         --project=PROJECT_ID \
         --location=LOCATION \
         --filter=FILTER_EXPRESSION \
     ```

     Replace the following:
     - `PROJECT_ID`: the ID of your management project.
     - `LOCATION`: the location of your applications. Use `global` for global applications, a multi-region (`us` or `eu`) for multi-regional applications, or a specific region, such as `us-east1`, for regional applications.
     - `FILTER_EXPRESSION`: the filter expression to specify attributes. For example, to list all applications with a `PRODUCTION` environment type, use `attributes.environment.type=PRODUCTION`.

## View application details

Follow these steps to view the detailed information of a specific application,
including its attributes and metadata:

### Console

1. In the Google Cloud console, use the project picker to select your
   management project.

2. Navigate to the **Applications** page from App Hub:


   [Go to Applications](https://console.cloud.google.com/apphub/applications)

   <br />

   The page displays a list of your applications.
3. Click the name of the application you want to view.

   The application's **Details** tab is displayed.

### gcloud

1. [Find the project ID](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#identifying_projects)
   of your management project.

2. Describe an application:

   ```bash
   gcloud apphub applications describe APPLICATION_NAME \
       --project=PROJECT_ID \
       --location=LOCATION
   ```

   Replace the following:
   - `APPLICATION_NAME`: the name of your application. You specify this value when you [create an application](https://docs.cloud.google.com/app-hub/docs/register-resources.md.txt#create-an-application).
   - `PROJECT_ID`: the ID of your management project.
   - `LOCATION`: the location of your application. Use `global` for global applications, a multi-region (`us` or `eu`) for multi-regional applications, or a specific region, such as `us-east1`, for regional applications.

## Update application attributes

To modify the [attributes](https://docs.cloud.google.com/app-hub/docs/overview.md.txt#properties-and-attributes) of
an application after it has been created, follow these steps. Services and
workloads can also use the same application attributes during
[registration](https://docs.cloud.google.com/app-hub/docs/register-resources.md.txt).

### Console

1. In the Google Cloud console, use the project picker to select your
   management project.

2. Navigate to the **Applications** page from App Hub:


   [Go to Applications](https://console.cloud.google.com/apphub/applications)

   <br />

   The page displays a list of your applications.
3. For the application you want to update, click
   **Edit**.

4. In the **Edit application** pane, modify the fields as needed.

5. Click **Save**.

### gcloud

1. [Find the project ID](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#identifying_projects)
   of your management project.

2. Update application attributes. You can update any of the mutable
   attributes, such as `display-name`, `criticality-type`,
   `environment-type`, and owners:

   ```bash
   gcloud apphub applications update APPLICATION_NAME \
       --project=PROJECT_ID \
       --location=LOCATION \
       --display-name=DISPLAY_NAME \
       --criticality-type=CRITICALITY_LEVEL \
       --environment-type=ENVIRONMENT \
       --developer-owners=display-name=DEV_NAME,email=DEV_EMAIL \
       --operator-owners=display-name=OPERATOR_NAME,email=OPERATOR_EMAIL \
       --business-owners=display-name=BUSINESS_NAME,email=BUSINESS_EMAIL
   ```

   Replace the following:
   - Required: `APPLICATION_NAME`: the name of your application. You specify this value when you [create an application](https://docs.cloud.google.com/app-hub/docs/register-resources.md.txt#create-an-application).
   - Required: `PROJECT_ID`: the ID of your management project.
   - Required: `LOCATION`: the location of your application. Use `global` for global applications, a multi-region (`us` or `eu`) for multi-regional applications, or a specific region, such as `us-east1`, for regional applications.
   - Optional: `DISPLAY_NAME`: the display name of your application.
   - Optional: `CRITICALITY_LEVEL`: the importance
     level of the application. Use one of the following values:

     - `MISSION_CRITICAL`
     - `HIGH`
     - `MEDIUM`
     - `LOW`
   - Optional: `ENVIRONMENT`: the stage of the
     software lifecycle. Use one of the following values:

     - `PRODUCTION`
     - `STAGING`
     - `DEVELOPMENT`
     - `TEST`
   - Optional: `DEV_NAME` and
     `DEV_EMAIL`: the display name and email
     address of the developer owner, respectively.

   - Optional: `OPERATOR_NAME` and
     `OPERATOR_EMAIL`: the display name and email
     address of the operator owner, respectively.

   - Optional: `BUSINESS_NAME` and
     `BUSINESS_EMAIL`: the display name and email
     address of the business owner, respectively.

   > [!NOTE]
   > **Note:** Email addresses must have the format `username@yourdomain`, for example, `jane-doe@gmail.com`.

### Terraform

To update application attributes with Terraform, modify the arguments within
[the `google_apphub_application` resource](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/apphub_application)
block in your configuration file. When you apply the changes, Terraform
updates the application to match the new configuration.

The following example updates the criticality and environment attributes of
a regional application in `us-central1`:

```terraform
resource "google_apphub_application" "example" {
    project        = "my-project-id"
    location       = "us-central1"
    application_id = "my-application"
    display_name   = "My Application"
    description    = "This application represents our platform."
    attributes {
        criticality {
            type = "HIGH" # Updated criticality
        }
        environment {
            type = "PRODUCTION"
        }
        # ... other attributes
    }
}
```

## Delete an application

Before you can delete an application, you must first
[unregister all of its services and workloads](https://docs.cloud.google.com/app-hub/docs/modify-app-hub-resources.md.txt#unregister).
Then, follow these steps to delete the application:

### Console

1. In the Google Cloud console, use the project picker to select your
   management project.

2. Navigate to the **Applications** page from App Hub:


   [Go to Applications](https://console.cloud.google.com/apphub/applications)

   <br />

   The page displays a list of your applications.
3. Click the name of the application you want to delete.

4. Go to the **Services and workloads** tab and make sure you have
   unregistered all the application components. For more information, see
   [Unregister services and workloads](https://docs.cloud.google.com/app-hub/docs/modify-app-hub-resources.md.txt#unregister).

5. After all services and workloads are unregistered, navigate back to the
   application details and click **Delete**.

### gcloud

1. [Find the project ID](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#identifying_projects)
   of your management project.

2. Make sure you have unregistered all the application components. For more
   information, see
   [Unregister services and workloads](https://docs.cloud.google.com/app-hub/docs/modify-app-hub-resources.md.txt#unregister).

3. After the application has no registered components, delete it:

   ```bash
   gcloud apphub applications delete APPLICATION_NAME \
       --project=PROJECT_ID \
       --location=LOCATION
   ```

   Replace the following:
   - `APPLICATION_NAME`: the name of your application. You specify this value when you [create an application](https://docs.cloud.google.com/app-hub/docs/register-resources.md.txt#create-an-application).
   - `PROJECT_ID`: the ID of your management project.
   - `LOCATION`: the location of your application. Use `global` for global applications, a multi-region (`us` or `eu`) for multi-regional applications, or a specific region, such as `us-east1`, for regional applications.

### Terraform

To delete an application that is managed by Terraform, you have the
following options:

- **Remove the resource from your configuration** : Delete [the `google_apphub_application` resource](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/apphub_application) block from your Terraform file and then run `terraform apply`. Terraform recognizes that the resource is no longer in the configuration and deletes it from your project.
- **Terminate all resources** : Run the `terraform destroy` command to terminate all resources managed by your Terraform configuration, including the application.

## What's next

- [Manage services and workloads](https://docs.cloud.google.com/app-hub/docs/modify-app-hub-resources.md.txt)
- [Optimize an application with design recommendations](https://docs.cloud.google.com/app-hub/docs/optimize-applications.md.txt)
- [Monitor your applications](https://docs.cloud.google.com/app-hub/docs/monitor-applications.md.txt)