--- description: Learn how to manage Grafana Cloud Provider Observability resources in Grafana Cloud using Terraform keywords: - Infrastructure as Code - Quickstart - Grafana Cloud - Terraform - Cloud Provider Observability title: Manage Cloud Provider Observability in Grafana Cloud using Terraform weight: 210 canonical: https://grafana.com/docs/grafana/latest/as-code/infrastructure-as-code/terraform/terraform-cloud-provider-o11y/ --- # Manage Cloud Provider Observability in Grafana Cloud using Terraform Manage Cloud Provider Observability, including Amazon CloudWatch and Microsoft Azure resources, in Grafana Cloud using Terraform. For more information on Cloud Provider Observability, refer to the [Cloud Provider Observability](/docs/grafana-cloud/monitor-infrastructure/monitor-cloud-provider/) documentation. ## Before you begin Before you begin, you should have the following available: - A Grafana Cloud account - For more information on setting up a Grafana Cloud account, refer to [Get started](/docs/grafana-cloud/get-started/). - Terraform installed on your machine - For more information on how to install Terraform, refer to the [Terraform install documentation](https://developer.hashicorp.com/terraform/install). - Administrator permissions in your Grafana instance - For more information on assigning Grafana RBAC roles, refer to [Assign RBAC roles](/docs/grafana-cloud/security-and-account-management/authentication-and-permissions/access-control/assign-rbac-roles/). {{< admonition type="note" >}} Save all of the following Terraform configuration files in the same directory. {{< /admonition >}} ## Configure authentication for the Grafana Provider The Grafana Provider is a logical abstraction of an upstream API that you can use to interact with Grafana Cloud resources. You must configure it with the following information: - A Grafana Cloud access policy token that includes the permissions the provider needs to access the Grafana Cloud Provider API. - A regional cloud provider API endpoint to establish which Grafana Cloud stack you are accessing. To configure authentication for the Grafana Provider: 1. Create a Grafana Cloud access policy and token. - To create an access policy for your organization, refer to the [Create an access policy for a stack steps](/docs/grafana-cloud/security-and-account-management/authentication-and-permissions/access-policies/create-access-policies/#create-an-access-policy-for-a-stack) and use the following scopes listed for the supported Amazon CloudWatch or Microsoft Azure resources: - Amazon CloudWatch - Metrics scrape or resource metadata scrape - `integration-management:read` - `integration-management:write` - `stacks:read` - Metric streams - `metrics:write` - ALB access logs, logs with Lambda, or logs with Amazon Data Firehose - `logs:write` - Microsoft Azure - Serverless metrics - `integration-management:read` - `integration-management:write` - `stacks:read` - Logs with Azure functions - `logs:write` 1. Obtain the regional Cloud Provider API endpoint. - To obtain the regional Cloud provider API endpoint, use your access policy token and the following command to return a list of all of the Grafana stacks you own, along with their respective Cloud Provider API hostnames: ```bash curl -sH "Authorization: Bearer " "https://grafana.com/api/instances" | \ jq '[.items[]|{stackName: .slug, clusterName:.clusterSlug, cloudProviderAPIURL: "https://cloud-provider-api-\(.clusterSlug).grafana.net"}]' ``` 1. Create a file named `cloud-provider.tf` and add the following code block: ```tf terraform { required_providers { grafana = { source = "grafana/grafana" } } } provider "grafana" { cloud_api_url = "" cloud_access_policy_token = "" } ``` 1. Create a `variables.tf` file and paste the `` and `