Docs » Connect to your cloud service provider » Connect AWS to Splunk Observability Cloud » Connect your cloud services using Splunk Terraform

Connect your cloud services using Splunk Terraform 🔗

If you use Terraform to turn Splunk Observability Cloud APIs into configuration files and don’t want to configure your system manually through guided setup, use splunk-terraform/signalfx, the Splunk Terraform provider, to connect Splunk Observability Cloud to AWS, Azure, or GCP.

The HashiCorp Configuration Language underlying Terraform supports automation. Although you can apply one configuration file to multiple cloud service providers, this topic explains how to connect a single service to Splunk Observability Cloud using the Terraform Registry.

As with other connection options, Terraform uses the Splunk Observability REST API endpoints. For examples, see:

Requirements 🔗

See the requirements for each cloud services provider:

Note

To use CloudWatch Metric Streams or retrieve logs from AWS services, you need to deploy additional resources on your AWS account using one of the CloudFormation templates provided by Splunk. Also, review your IAM policy to ensure all the required actions are available to Splunk Observability Cloud.

Required tokens 🔗

You might need these Splunk tokens to configure Terraform:

Splunk Observability Cloud user API access token (mandatory) 🔗

To obtain your user API access token:

  1. Go to Splunk Observability Cloud and select Settings.

  2. Select your avatar or name on the top to access your Personal information. Your user API access token is available on the right corner.

Splunk Observability Cloud org token 🔗

To obtain your org token, you have two options:

Configure Terraform to connect to your cloud services 🔗

Note

Terraform documentation identifies Splunk Observability Cloud as SignalFx. Integrations are therefore called signalfx_aws_integration, signalfx_azure_integration, and signalfx_gcp_integration.

To configure a connection through Terraform, perform the following steps:

  1. Go to Terraform’s Registry and look for signalfx in the search box. You’ll find splunk-terraform’s signalFx provider site with docs, the available resources, and the compatible data sources.

  2. Copy the Use provider code to add SignalFx in the required_providers block of main.tf in your configuration file. It looks similar to:

    terraform {
      required_providers {
        splunk = {
          source = "splunk-terraform/signalfx"
          version = "6.22.0"
        }
      }
    }
    
    provider "signalfx" {
      auth_token = "${var.signalfx_auth_token}"
    }
    
    # Add resources
    resource "signalfx_dasboard" "default" {
      # ...
    }
    
  3. Required. Paste you user API access token in the auth_token field in the provider config file. You can also set it using the SFX_AUTH_TOKEN environment variable. This is required to authenticate Terraform requests to Splunk Observability Cloud’s API.

  4. Configure the required additional resources, which are Terraform’s infrastructure objects.

  • For AWS, you need the signalfx_aws_integration resource. You can add your org token in the namedToken field to see how much traffic is coming from the integration it identifies, if you use different tokens per integration.

    • If you’re authenticating using the IAM policy and ARN roles, see signalfx_aws_external_integration. Copy and modify the example syntax provided in the documentation section of Terraform Registry’s SignalFx page and use it to authenticate in AWS.

    • If you’re using AWS Security Token authentication, paste your AWS token in the signalfx_aws_token_integration resource token/key fields.

  • For Azure, use the signalfx_azure_integration resource.

  • For GCP, use the signalfx_gcp_integration resource.

  1. Add your cloud service as a data source, as described in: Data Source: signalfx_aws_services, Data Source: signalfx_azure_services, or Data Source: signalfx_gcp_services. Data sources allow Terraform to use information defined outside of Terraform, defined by another separate Terraform configuration, or modified by functions.

Note

For more Terraform syntax examples, see the blog entry Manage Your Splunk Infrastructure as Code Using Terraform . For examples of how to configure through the Splunk Observability Cloud API, see Connect to AWS using the Splunk Observability Cloud API.

Next steps 🔗

After you connect Splunk Observability Cloud with your cloud services provider: