Skip to content

core.avoid_null_provider

Enforces that the hashicorp/null provider is not used.

Why

The hashicorp/null provider was widely used in older Terraform versions for "glue logic", but it's now considered obsolete and discouraged.

You should not use it anymore and replace it with terraform_data for null_resource and locals for null_data_source.

Triggers

  • Any usage of null_resource or null_data_source

Example

Bad

resource "null_resource" "config" {
  triggers = {
    config = var.config
  }
}
data "null_data_source" "example" {
  inputs = {
    full_id = "${var.name}-${var.region}"
  }
}

Good

resource "terraform_data" "config" {
  input = var.config
}

locals {
  full_id = "${var.name}-${var.region}"
}

Configuration

There is currently no configuration flags for that rule, beside the option to enable or disable the rule