<commit_before>---
layout: "null"
page_title: "Null Data Source"
sidebar_current: "docs-data-source"
description: |-
  A data source that does nothing.
---

# Null Resource

The `null_data_source` data source implements the standard data source
lifecycle but does not interact with any external APIs.

## Example Usage

The primary use-case for the null data source is to gather together
collections of intermediate values to re-use elsewhere in configuration:

```hcl
data "null_data_source" "values" {
  inputs = {
    all_server_ids = "${concat(aws_instance.green.*.id, aws_instance.blue.*.id)}"
    all_server_ips = "${concat(aws_instance.green.*.private_ip, aws_instance.blue.*.private_ip)}"
  }
}

resource "aws_elb" "main" {
  # ...

  instances = "${data.null_data_source.values.outputs["all_server_ids"]}"
}

output "all_server_ids" {
  value = "${data.null_data_source.values.outputs["all_server_ids"]}"
}

output "all_server_ips" {
  value = "${data.null_data_source.values.outputs["all_server_ips"]}"
}

# ... (other uses of the values) ...
```

## Argument Reference

The following arguments are supported:

* `inputs` - (Optional) A map of arbitrary strings that is copied into the
  `outputs` attribute, and accessible directly for interpolation.

* `has_computed_default` - (Optional) If set, its literal value will be
  stored and returned. If not, its value defaults to `"default"`. This
  argument exists primarily for testing and has little practical use.

## Attributes Reference

The following attributes are exported:

* `outputs` - After the data source is "read", a copy of the `inputs` map.

* `random` - A random value. This is primarily for testing and has little
  practical use; prefer
  [the `random` provider](/docs/providers/random/)
  for more practical random number use-cases.
<commit_msg>Update docs link to random provider to the Registry<commit_after>---
layout: "null"
page_title: "Null Data Source"
sidebar_current: "docs-data-source"
description: |-
  A data source that does nothing.
---

# Null Resource

The `null_data_source` data source implements the standard data source
lifecycle but does not interact with any external APIs.

## Example Usage

The primary use-case for the null data source is to gather together
collections of intermediate values to re-use elsewhere in configuration:

```hcl
data "null_data_source" "values" {
  inputs = {
    all_server_ids = "${concat(aws_instance.green.*.id, aws_instance.blue.*.id)}"
    all_server_ips = "${concat(aws_instance.green.*.private_ip, aws_instance.blue.*.private_ip)}"
  }
}

resource "aws_elb" "main" {
  # ...

  instances = "${data.null_data_source.values.outputs["all_server_ids"]}"
}

output "all_server_ids" {
  value = "${data.null_data_source.values.outputs["all_server_ids"]}"
}

output "all_server_ips" {
  value = "${data.null_data_source.values.outputs["all_server_ips"]}"
}

# ... (other uses of the values) ...
```

## Argument Reference

The following arguments are supported:

* `inputs` - (Optional) A map of arbitrary strings that is copied into the
  `outputs` attribute, and accessible directly for interpolation.

* `has_computed_default` - (Optional) If set, its literal value will be
  stored and returned. If not, its value defaults to `"default"`. This
  argument exists primarily for testing and has little practical use.

## Attributes Reference

The following attributes are exported:

* `outputs` - After the data source is "read", a copy of the `inputs` map.

* `random` - A random value. This is primarily for testing and has little
  practical use; prefer
  [the `random` provider](https://registry.terraform.io/providers/hashicorp/random)
  for more practical random number use-cases.

{'fraction_non_alphanumeric': 0.11233539371136791, 'fraction_numerical': 0.0, 'mean_word_length': 4.457478005865102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '808171', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1105, 'n_words': 384}