---
sidebar_label: IaC provider
doc_id: 4ccb30fd-b95b-4f5b-b8f9-204aeb486560
description: >-
  Guide for using the nullplatform IaC provider with Terraform and OpenTofu to
  automate infrastructure management.
keywords:
  - nullplatform
  - IaC
  - Terraform
  - OpenTofu
  - infrastructure-as-code
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Using the nullplatform IaC provider

The nullplatform IaC provider lets you manage your nullplatform resources using infrastructure-as-code (IaC) tools, simplifying how you automate and manage infrastructure.

:::info
This guide applies to IaC tools such as Terraform and OpenTofu.
:::

## Installation

1. To use the provider, add the following to your IaC configuration:

    ```hcl
    terraform {
      required_providers {
        nullplatform = {
          source  = "nullplatform/nullplatform"
          version = "x.y.z"   // Replace with a specific version or omit to use the latest
        }
      }
    }
    ```

2. Run the following command to install the provider:
   
   <Tabs>
       <TabItem value="OpenTofu" label="OpenTofu">
           ```bash
           tofu init
           ```
       </TabItem>
       <TabItem value="Terraform" label="Terraform">
           ```bash
           terraform init
           ```
       </TabItem>
   </Tabs>


3. Run the following command to check the provider is correctly installed.
   
   <Tabs>
       <TabItem value="OpenTofu" label="OpenTofu">
           ```bash
           tofu providers | grep nullplatform
           ```
       </TabItem>
       <TabItem value="Terraform" label="Terraform">
           ```bash
           terraform providers | grep nullplatform
           ```
       </TabItem>
   </Tabs>

    If installed correctly, you should see an output similar to:

    ```bash
    ├── provider[registry.nullplatform.io/nullplatform/nullplatform]
    ```

## Authentication

To authenticate, configure the provider with an API key. You can set the API key either as a variable or by using the `NULLPLATFORM_API_KEY` environment variable.

```hcl
provider "nullplatform" {
  api_key = var.nullplatform_api_key
}
```

See our [API keys docs](/docs/authorization/#api-keys-for-machine-users) for more info. 

## Next steps

Refer to [our IaC provider plugin](https://registry.terraform.io/providers/nullplatform/nullplatform/latest/docs) for additional documentation, including resource details and configuration examples.
