Skip to content

Commit 22883bd

Browse files
committed
add examples
1 parent d565664 commit 22883bd

File tree

6 files changed

+40
-4
lines changed

6 files changed

+40
-4
lines changed

docs/data-sources/cdn_distribution.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ CDN distribution data source schema.
1313

1414
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
1515

16-
16+
## Example Usage
17+
18+
```terraform
19+
data "stackit_cdn_distribution" "example" {
20+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
21+
distribution_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
22+
}
23+
```
1724

1825
<!-- schema generated by tfplugindocs -->
1926
## Schema

docs/resources/cdn_distribution.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,21 @@ CDN distribution data source schema.
1313

1414
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
1515

16-
16+
## Example Usage
17+
18+
```terraform
19+
# Create a CDN distribution
20+
resource "stackit_cdn_distribution" "example_distribution" {
21+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
22+
config = {
23+
backend = {
24+
type = "http"
25+
origin_url = "mybackend.onstackit.cloud"
26+
}
27+
regions = ["EN", "US", "ASIA", "AF", "SA"]
28+
}
29+
}
30+
```
1731

1832
<!-- schema generated by tfplugindocs -->
1933
## Schema
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
data "stackit_cdn_distribution" "example" {
2+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
3+
distribution_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
4+
}
5+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Create a CDN distribution
2+
resource "stackit_cdn_distribution" "example_distribution" {
3+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
4+
config = {
5+
backend = {
6+
type = "http"
7+
origin_url = "mybackend.onstackit.cloud"
8+
}
9+
regions = ["EN", "US", "ASIA", "AF", "SA"]
10+
}
11+
}

stackit/internal/services/cdn/distribution/datasource.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,4 @@ func (r *distributionDataSource) Read(ctx context.Context, req datasource.ReadRe
221221
}
222222
diags = resp.State.Set(ctx, &model)
223223
resp.Diagnostics.Append(diags...)
224-
return
225224
}

stackit/internal/services/cdn/distribution/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ func (r *distributionResource) Update(ctx context.Context, req resource.UpdateRe
401401
}
402402
regions = append(regions, *regionEnum)
403403
}
404-
_, err := r.client.PatchDistribution(ctx, projectId, distributionId).PatchDistributionPayload(*&cdn.PatchDistributionPayload{
404+
_, err := r.client.PatchDistribution(ctx, projectId, distributionId).PatchDistributionPayload(cdn.PatchDistributionPayload{
405405
Config: &cdn.ConfigPatch{
406406
Backend: &cdn.ConfigPatchBackend{
407407
HttpBackendPatch: &cdn.HttpBackendPatch{

0 commit comments

Comments
 (0)