Skip to content

Commit 2dd2006

Browse files
committed
Update ID usage
1 parent 93759f2 commit 2dd2006

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

docs/data-sources/data_source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ output "all_server_ips" {
4848
### Optional
4949

5050
- **has_computed_default** (String) 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.
51-
- **id** (String) The ID of this resource.
5251
- **inputs** (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
5352

5453
### Read-Only
5554

55+
- **id** (String, Deprecated) This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.
5656
- **outputs** (Map of String) After the data source is "read", a copy of the `inputs` map.
5757
- **random** (String) A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.
5858

docs/resources/resource.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ resource "null_resource" "cluster" {
5555

5656
### Optional
5757

58-
- **id** (String) The ID of this resource.
5958
- **triggers** (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
6059

60+
### Read-Only
61+
62+
- **id** (String) This is set to a random value at create time.
63+

internal/provider/data_source.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import (
99

1010
func dataSource() *schema.Resource {
1111
return &schema.Resource{
12+
DeprecationMessage: "The null_data_source was historically used to construct intermediate values to re-use elsewhere " +
13+
"in configuration, the same can now be achieved using locals",
14+
1215
Description: `The ` + "`null_data_source`" + ` data source implements the standard data source lifecycle but does not
1316
interact with any external APIs.
1417
@@ -40,6 +43,13 @@ same can now be achieved using [locals](https://www.terraform.io/docs/language/v
4043
Optional: true,
4144
Computed: true,
4245
},
46+
47+
"id": {
48+
Description: "This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.",
49+
Computed: true,
50+
Deprecated: "This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.",
51+
Type: schema.TypeString,
52+
},
4353
},
4454
}
4555
}

internal/provider/resource.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ The ` + "`triggers`" + ` argument allows specifying an arbitrary set of values t
2424
Optional: true,
2525
ForceNew: true,
2626
},
27+
28+
"id": {
29+
Description: "This is set to a random value at create time.",
30+
Computed: true,
31+
Type: schema.TypeString,
32+
},
2733
},
2834
}
2935
}

0 commit comments

Comments
 (0)