Skip to content

Commit 9543595

Browse files
committed
add example in doc and remove comments
1 parent 2e1e950 commit 9543595

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

datadog/fwprovider/resource_datadog_custom_framework.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,6 @@ func (r *customFrameworkResource) Read(ctx context.Context, request resource.Rea
162162
data, _, err := r.Api.GetCustomFramework(r.Auth, state.Handle.ValueString(), state.Version.ValueString())
163163
// If the framework does not exist, remove it from terraform state
164164
// This is to avoid the provider to return an error when the framework is deleted in the UI prior
165-
166-
// DELETE example:
167-
// 1. create the framework in terraform
168-
// 2. delete the framework in the UI
169-
// 3. run terraform plan
170-
// 4. terraform will see that the framework does not exist so it will remove it from the state
171-
// 5. no changes are calculated by terraform so nothing is updated
172-
173-
// UPDATE example:
174-
// 1. create the framework in terraform
175-
// 2. delete the framework in the UI
176-
// 3. update the framework in terraform
177-
// 4. run terraform plan
178-
// 5. terraform will see that the framework does not exist so it will remove it from the state
179-
// 6. terraform will perform a create action for the framework
180165
if err != nil && err.Error() == "400 Bad Request" {
181166
// Clear the state completely
182167
response.State.RemoveResource(ctx)

docs/resources/custom_framework.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,28 @@ description: |-
1010

1111
Manages custom framework in Datadog.
1212

13-
13+
## Example Usage
14+
15+
```terraform
16+
resource "datadog_custom_framework" "example4" {
17+
version = "1"
18+
handle = "new-terraform-framework-handle"
19+
name = "new-terraform-framework"
20+
icon_url = "https://example.com/icon.png"
21+
description = "This is a test I created this resource through terraform"
22+
requirements {
23+
name = "requirement1"
24+
controls {
25+
name = "new-control"
26+
rules_id = ["def-000-be9", "def-000-cea"]
27+
}
28+
controls {
29+
name = "new-control"
30+
rules_id = ["def-000-be9"]
31+
}
32+
}
33+
}
34+
```
1435

1536
<!-- schema generated by tfplugindocs -->
1637
## Schema
@@ -40,7 +61,7 @@ Required:
4061

4162
Optional:
4263

43-
- `controls` (Block Set) The controls of the requirement. (see [below for nested schema](#nestedblock--requirements--controls))
64+
- `controls` (Block Set) The controls of the requirement. At least one control is required. (see [below for nested schema](#nestedblock--requirements--controls))
4465

4566
<a id="nestedblock--requirements--controls"></a>
4667
### Nested Schema for `requirements.controls`
@@ -55,5 +76,5 @@ Required:
5576
Import is supported using the following syntax:
5677

5778
```shell
58-
terraform import datadog_custom_framework.example2 "new-terraform-framework-test-2"
79+
terraform import datadog_custom_framework.example3 "terraform-created-framework-handle-1.0.0"
5980
```

0 commit comments

Comments
 (0)