This page describes how to view information about resources that are provisioned by Infrastructure Manager.
You may want to view resources to understand their state, or to see what resources exist in a deployment before you update or delete the deployment.
When Infrastructure Manager deploys a Terraform configuration, the service provisions and configures the Google Cloud resources that are defined in the configuration. Metadata about these resources are in the Terraform state file, and Infra Manager stores this file for each deployment and revision.
The state file has information about the resources when they are provisioned by Infra Manager. The state file and Infra Manager do not have information about these resources if they are modified, unless they are modified by a Infra Manager revision.
For example, you can use Infra Manager to deploy a load balancer and then you can modify the load balancer using the Google Cloud console. In this case, Infra Manager has information about the load balancer that was initially provisioned, but not about the changes that you did through the Google Cloud console.
If you need information about the deployment name or state, see View deployments.
Before you begin
- Ensure Infra Manager is enabled.
- Ensure you have a service account.
- Ensure that you have the IAM permissions needed to view deployments.
roles/config.admin
orroles/config.viewer
.
List resources provisioned by a deployment
To list the resources provisioned by a deployment:
gcloud infra-manager resources list --revision=projects/PROJECT_ID/locations/LOCATION/deployments/DEPLOYMENT_ID/revisions/REVISION_ID
Replace:
- PROJECT_ID: the project ID where Infrastructure Manager runs.
- LOCATION: the location where Infra Manager runs. See Infrastructure Manager locations for the list of valid locations.
- DEPLOYMENT_ID: the deployment identifier of the resource's deployment.
- REVISION_ID: the revision identifier of the revision you're viewing.
Filter the list of resources
To filter the list of resources:
gcloud infra-manager resources list --revision=projects/PROJECT_ID/locations/LOCATION/deployments/DEPLOYMENT_ID/revisions/REVISION_ID --filter=EXPRESSION
Replace:
- PROJECT_ID: the project ID where Infrastructure Manager runs.
- LOCATION: the location where Infra Manager runs. See Infrastructure Manager locations for the list of valid locations.
- DEPLOYMENT_ID: the deployment identifier of the resource's deployment.
- REVISION_ID: the revision identifier of the revision you're viewing and filtering.
- EXPRESSION: the expression you are filtering for. Supported
expressions are:
terraformInfo.address (string)
terraformInfo.type (string)
terraformInfo.id (string)
state (string)
, one of:STATE_UNSPECIFIED
,PLANNED
,IN_PROGRESS
,RECONCILED
,FAILED
intent(string)
, one of:INTENT_UNSPECIFIED
,CREATE
,UPDATE
,DELETE
,RECREATE
,UNCHANGED
caiAssets.fullResourceName
(map)caiAssets.type
(map)
Sort the list of resources
To sort the list of resources:
gcloud infra-manager resources list --revision=projects/PROJECT_ID/locations/LOCATION/deployments/DEPLOYMENT_ID/revisions/REVISION_ID --sort-by=[FIELD]
Replace:
- PROJECT_ID: the project ID where Infrastructure Manager runs.
- LOCATION: the location where Infra Manager runs. See Infrastructure Manager locations for the list of valid locations.
- DEPLOYMENT_ID: the deployment identifier of the resource's deployment.
- REVISION_ID: the revision identifier of the revision you're viewing and sorting.
- FIELD: the field used to sort. Supported fields are:
name
terraformInfo.address
terraformInfo.type
terraformInfo.id
View details about a resource
To view details about a specific resource, use the resource ID:
gcloud infra-manager resources describe projects/PROJECT_ID/locations/LOCATION/deployments/DEPLOYMENT_ID/revisions/REVISION_ID/resources/RESOURCE_ID
Replace:
- PROJECT_ID: the project ID where Infrastructure Manager runs.
- LOCATION: the location where Infra Manager runs. See Infrastructure Manager locations for the list of valid locations.
- DEPLOYMENT_ID: the deployment identifier of the resource's deployment.
- REVISION_ID: the revision identifier of the specific revision that deployed the resource.
- RESOURCE_ID: the resource ID of the resource you're viewing.
What's next
- Learn more about Terraform with Google Cloud.
- Automate deployments.
- Update a deployment.
- View the state of a deployment.
- Delete a deployment.