Skip to content

Commit 92a974f

Browse files
committed
feat!: implemented value_is_known and value_is_fully_known
1 parent df1b9bb commit 92a974f

File tree

78 files changed

+1514
-1581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1514
-1581
lines changed

docs/data-sources/temp_dir.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "value_temp_dir Data Source - terraform-provider-value"
4+
subcategory: ""
5+
description: |-
6+
Simply returns the OS-dependent temporary directory (e.g. /tmp).
7+
---
8+
9+
# value_temp_dir (Data Source)
10+
11+
Simply returns the OS-dependent temporary directory (e.g. /tmp).
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Read-Only
19+
20+
- `path` (String) The OS-dependent temporary directory.
21+
22+

docs/resources/is_fully_known.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,51 @@
33
page_title: "value_is_fully_known Resource - terraform-provider-value"
44
subcategory: ""
55
description: |-
6-
Allows you to have a access to result during plan phase that states whether valueor any nested attribute is marked as (known after apply) or not.
6+
Allows you to have a access to result during plan phase that states whether value or any nested attribute is marked as "(known after apply)" or not.
7+
Provider Metadata
8+
Each module can use provider_meta. Beware that these settings only count for resources of this module. (see https://www.terraform.io/internals/provider-meta):
9+
terraform
10+
// Terraform provider_meta example
11+
terraform {
12+
// "value" is the provider name
13+
provider_meta "value" {
14+
// {workdir} -> The only available placeholder currently (see below for more information)
15+
seed_prefix = "{workdir}#for-example" // Results into "/path/to/workdir#for-example"
16+
}
17+
}
18+
19+
Optional
20+
seed_prefix (String) It gets appended to each seed of any value_is_fully_known (resource) or value_is_known (resource) within the same module.
21+
Placeholders:
22+
"{workdir}" (Keyword) The actual workdir; equals to terraform's path.root. This placeholder is
23+
recommended because this value won't be drag along the plan and apply phase in comparison to
24+
abspath(path.root) that you would add to resource seed where a change to path.root would be
25+
recognized just as usual from terraform.
726
---
827

928
# value_is_fully_known (Resource)
1029

11-
Allows you to have a access to `result` during plan phase that states whether `value`or any nested attribute is marked as `(known after apply)` or not.
30+
Allows you to have a access to `result` during plan phase that states whether `value` or any nested attribute is marked as "(known after apply)" or not.
31+
## Provider Metadata
32+
Each module can use provider_meta. Beware that these settings only count for resources of this module. (see https://www.terraform.io/internals/provider-meta):
33+
```terraform
34+
// Terraform provider_meta example
35+
terraform {
36+
// "value" is the provider name
37+
provider_meta "value" {
38+
// {workdir} -> The only available placeholder currently (see below for more information)
39+
seed_prefix = "{workdir}#for-example" // Results into "/path/to/workdir#for-example"
40+
}
41+
}
42+
```
43+
### Optional
44+
- `seed_prefix` (String) It gets appended to each seed of any `value_is_fully_known` (resource) or `value_is_known` (resource) within the same module.
45+
46+
**Placeholders**:
47+
- "{workdir}" (Keyword) The actual workdir; equals to terraform's path.root. This placeholder is
48+
recommended because this value won't be drag along the plan and apply phase in comparison to
49+
abspath(path.root) that you would add to resource seed where a change to path.root would be
50+
recognized just as usual from terraform.
1251

1352

1453

@@ -17,10 +56,12 @@ Allows you to have a access to `result` during plan phase that states whether `v
1756

1857
### Required
1958

20-
- `value` (Dynamic) The `value` and nested attributes to test against `(known after apply)`
59+
- `proposed_unknown` (Dynamic) It is very crucial that this field is **not** filled by any custom value except the one produced by `value_unknown_proposer` (resource). This has the reason as its `value` is **always** unknown during the plan phase. On this behaviour this resource must rely and it cannot check if you do not so!
60+
- `unique_seed` (String) Attention! The seed is being used to determine resource uniqueness prior and during apply-phase. Very important to state is that the **seed must be fully known during the plan phase**, otherwise, an error is thrown. Within one terraform plan & apply the **seed of every "value_is_fully_known" must be unique**! I recommend you to use the provider_meta-feature for increased uniqueness. Under certain circumstances you may face problems if you run terraform concurrenctly. If you do so, then I recommend you to pass-through a random value via a user (environment) variable that you then add to the seed.
61+
- `value` (Dynamic) The `value` and if existing, nested attributes, are tested against "(known after apply)"
2162

22-
### Read-Only
63+
### Optional
2364

24-
- `result` (Boolean) States whether `value` or any nested attribute is marked as `(known after apply)` or not. If `value` is an aggregate type, not only the top level of the aggregate type is checked; elements and attributes are checked too.
65+
- `result` (Boolean) States whether `value` or any nested attribute is marked as "(known after apply)" or not. If `value` is an aggregate type, not only the top level of the aggregate type is checked; elements and attributes are checked too.
2566

2667

docs/resources/is_known.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,51 @@
33
page_title: "value_is_known Resource - terraform-provider-value"
44
subcategory: ""
55
description: |-
6-
Allows you to have a access to result during plan phase that states whether value is marked as (known after apply) or not.
6+
Allows you to have a access to result during plan phase that states whether value marked as "(known after apply)" or not.
7+
Provider Metadata
8+
Each module can use provider_meta. Beware that these settings only count for resources of this module. (see https://www.terraform.io/internals/provider-meta):
9+
terraform
10+
// Terraform provider_meta example
11+
terraform {
12+
// "value" is the provider name
13+
provider_meta "value" {
14+
// {workdir} -> The only available placeholder currently (see below for more information)
15+
seed_prefix = "{workdir}#for-example" // Results into "/path/to/workdir#for-example"
16+
}
17+
}
18+
19+
Optional
20+
seed_prefix (String) It gets appended to each seed of any value_is_fully_known (resource) or value_is_known (resource) within the same module.
21+
Placeholders:
22+
"{workdir}" (Keyword) The actual workdir; equals to terraform's path.root. This placeholder is
23+
recommended because this value won't be drag along the plan and apply phase in comparison to
24+
abspath(path.root) that you would add to resource seed where a change to path.root would be
25+
recognized just as usual from terraform.
726
---
827

928
# value_is_known (Resource)
1029

11-
Allows you to have a access to `result` during plan phase that states whether `value` is marked as `(known after apply)` or not.
30+
Allows you to have a access to `result` during plan phase that states whether `value` marked as "(known after apply)" or not.
31+
## Provider Metadata
32+
Each module can use provider_meta. Beware that these settings only count for resources of this module. (see https://www.terraform.io/internals/provider-meta):
33+
```terraform
34+
// Terraform provider_meta example
35+
terraform {
36+
// "value" is the provider name
37+
provider_meta "value" {
38+
// {workdir} -> The only available placeholder currently (see below for more information)
39+
seed_prefix = "{workdir}#for-example" // Results into "/path/to/workdir#for-example"
40+
}
41+
}
42+
```
43+
### Optional
44+
- `seed_prefix` (String) It gets appended to each seed of any `value_is_fully_known` (resource) or `value_is_known` (resource) within the same module.
45+
46+
**Placeholders**:
47+
- "{workdir}" (Keyword) The actual workdir; equals to terraform's path.root. This placeholder is
48+
recommended because this value won't be drag along the plan and apply phase in comparison to
49+
abspath(path.root) that you would add to resource seed where a change to path.root would be
50+
recognized just as usual from terraform.
1251

1352

1453

@@ -17,10 +56,12 @@ Allows you to have a access to `result` during plan phase that states whether `v
1756

1857
### Required
1958

20-
- `value` (Dynamic) The `value` to test against `(known after apply)`
59+
- `proposed_unknown` (Dynamic) It is very crucial that this field is **not** filled by any custom value except the one produced by `value_unknown_proposer` (resource). This has the reason as its `value` is **always** unknown during the plan phase. On this behaviour this resource must rely and it cannot check if you do not so!
60+
- `unique_seed` (String) Attention! The seed is being used to determine resource uniqueness prior and during apply-phase. Very important to state is that the **seed must be fully known during the plan phase**, otherwise, an error is thrown. Within one terraform plan & apply the **seed of every "value_is_known" must be unique**! I recommend you to use the provider_meta-feature for increased uniqueness. Under certain circumstances you may face problems if you run terraform concurrenctly. If you do so, then I recommend you to pass-through a random value via a user (environment) variable that you then add to the seed.
61+
- `value` (Dynamic) The `value` (not nested attributes) is test against "(known after apply)"
2162

22-
### Read-Only
63+
### Optional
2364

24-
- `result` (Boolean) States whether `value` is marked as `(known after apply)` or not. If `value` is an aggregate type, only the top level of the aggregate type is checked; elements and attributes are not checked.
65+
- `result` (Boolean) States whether `value` is marked as "(known after apply)" or not. If `value` is an aggregate type, only the top level of the aggregate type is checked; elements and attributes are not checked.
2566

2667

docs/resources/promise.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Allows you to treat a value as unknown. This is desirable when you want postcond
1717

1818
### Required
1919

20-
- `value` (Dynamic) The value to promise. Any (nested) change to `value` results into `result` to be marked as `(known after apply)`
20+
- `value` (Dynamic) The value to promise. Any (nested) change to `value` results into `result` to be marked as "(known after apply)"
2121

2222
### Read-Only
2323

24-
- `result` (Dynamic) `result` is as soon as you apply set to `value`. Every change of `value` results into `result` to be marked as `(known after apply)`
24+
- `result` (Dynamic) `result` is as soon as you apply set to `value`. Every change of `value` results into `result` to be marked as "(known after apply)"
2525

2626

docs/resources/replaced_when.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ resource creation and resource deletion as change you can try the following appr
6868

6969
### Read-Only
7070

71-
- `value` (String) If the very first condition is false or remains false, then the value remains unchanged.
71+
- `value` (String) If the very first condition is false, then the value will be once initialized by a random value.
72+
73+
If the condition is false or remains false, then the value remains unchanged.
7274
The condition change from true to false does not trigger a replacement of those who use the value as
7375
target for replace_triggered_by.
7476

docs/resources/unknown_proposer.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "value_unknown_proposer Resource - terraform-provider-value"
4+
subcategory: ""
5+
description: |-
6+
This resource is very obscure and misbehaving and you really should only use it for value_is_known.proposed_unknown or value_is_fully_known.proposed_unknown.
7+
---
8+
9+
# value_unknown_proposer (Resource)
10+
11+
This resource is very obscure and misbehaving and you really should only use it for `value_is_known.proposed_unknown` or `value_is_fully_known.proposed_unknown`.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Read-Only
19+
20+
- `value` (Boolean) This value will **always** be unknown during the plan phase but always true after apply phase.
21+
22+

examples/is_fully_known/.terraform.tfstate.lock.info

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/is_fully_known/main.tf

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
terraform {
2+
required_providers {
3+
value = {
4+
source = "github.com/pseudo-dynamic/value"
5+
version = "0.1.0"
6+
}
7+
}
8+
9+
provider_meta "value" {
10+
// {workdir} -> a placeholder (see docs)
11+
seed_prefix = "{workdir}"
12+
}
13+
}

examples/is_fully_known/shared.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// An "(known after apply)" value producer
2+
resource "value_unknown_proposer" "default" {}
3+
4+
resource "value_promise" "default" {
5+
value = "test"
6+
}

0 commit comments

Comments
 (0)