Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More

Anypoint Terraform Provider: `spec = null` Causes Plan Failure During API Instance Import

Publish Date: Jun 9, 2026
Description

When using the Anypoint Terraform Provider to import an API instance or when running `terraform plan` after generating configurations, you may encounter a plan failure. The error message indicates an issue with the `spec` attribute being `null`.

Example symptom during `terraform plan`:
```
Error: Invalid or unknown key: spec = null
```
This error typically occurs when the provider attempts to process or generate the API specification for an API instance, leading to an invalid configuration state.

Resolution

CAUSE

This issue is caused by an internal bug within versions of the Anypoint Terraform Provider prior to 1.0.3. These earlier versions incorrectly handled the API specification (`spec`) during the import or configuration generation process. This led to the provider producing or interpreting a `spec = null` value, which Terraform's validation logic cannot process, resulting in a plan failure.

SOLUTION

To resolve this issue, upgrade your Anypoint Terraform Provider to version 1.0.3 or later.

1.  **Upgrade Anypoint Terraform Provider:**
    Ensure your Terraform configuration specifies version `1.0.3` or higher for the Anypoint Provider.
    In your `versions.tf` file or within your provider block, update the required version constraint:
    ```terraform
    terraform {
      required_providers {
        anypoint = {
          source  = "mulesoft/anypoint"
          version = "~> 1.0.3" # Or specify a newer version like ">= 1.0.3"
        }
      }
    }
    ```
    After updating the version, run `terraform init` to download the new provider version. Then, you can proceed with `terraform plan` and `terraform apply` as usual.

2.  **Workaround (if immediate upgrade is not possible):**
    If you are unable to upgrade the provider immediately, you can manually import the API instances using the `terraform import` command. This method bypasses the configuration generation step that might be producing the `spec = null` error.
    *   For Mule APIs:
        ```bash
        terraform import anypoint_api_instance.your_api_instance_resource_name your_organization_id/your_api_id/your_api_version_id/your_api_instance_id
        ```
    *   For Omni APIs:
        ```bash
        terraform import anypoint_api_instance.your_omni_api_instance_resource_name your_organization_id/your_api_id/your_api_version_id/your_api_instance_id
        ```
    Replace `your_api_instance_resource_name`, `your_organization_id`, `your_api_id`, `your_api_version_id`, and `your_api_instance_id` with the actual values corresponding to your Anypoint Platform environment.

APPLIES TO

*   Anypoint Terraform Provider versions prior to 1.0.3
*   Terraform CLI

Knowledge Article Number

005386566

 
Loading
Salesforce Help | Article