Skip to content

Feat/dns zone observability extension#1540

Open
SerseusWasTaken wants to merge 3 commits into
mainfrom
feat/dns-zone-observability-extension
Open

Feat/dns zone observability extension#1540
SerseusWasTaken wants to merge 3 commits into
mainfrom
feat/dns-zone-observability-extension

Conversation

@SerseusWasTaken

Copy link
Copy Markdown
Contributor

Description

relates to #STACKITTPR-319 and closes #941

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@SerseusWasTaken SerseusWasTaken requested a review from a team as a code owner June 26, 2026 06:18
@SerseusWasTaken SerseusWasTaken marked this pull request as draft June 26, 2026 06:21
@SerseusWasTaken SerseusWasTaken force-pushed the feat/dns-zone-observability-extension branch 5 times, most recently from f3b6422 to fc58f24 Compare June 26, 2026 07:40
@SerseusWasTaken SerseusWasTaken marked this pull request as ready for review June 26, 2026 07:48
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

@github-actions github-actions Bot added the Stale PR is marked as stale due to inactivity. label Jul 4, 2026
@SerseusWasTaken SerseusWasTaken force-pushed the feat/dns-zone-observability-extension branch from fc58f24 to 1eb0838 Compare July 8, 2026 06:12
@github-actions github-actions Bot removed the Stale PR is marked as stale due to inactivity. label Jul 9, 2026
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns 0.00% (ø)
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns/zone 22.02% (+3.46%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns/zone/datasource.go 0.00% (ø) 64 0 64
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns/zone/resource.go 27.38% (+3.59%) 263 (+36) 72 (+18) 191 (+18) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns/dns_acc_test.go
  • github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns/zone/resource_test.go


// getExtensionsPayload reads the extensions from the model and maps it to [dns.ZoneExtensions].
// Returns nil if the model does not provide any extensions.
func getExtensionsPayload(ctx context.Context, model *Model) (*dns.ZoneExtensions, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, I would rename it to stay consistent to other payload functions

Suggested change
func getExtensionsPayload(ctx context.Context, model *Model) (*dns.ZoneExtensions, error) {
func toExtensionsPayload(ctx context.Context, model *Model) (*dns.ZoneExtensions, error) {

Comment on lines +784 to +787
observabilityExtension := dns.NewZoneObservabilityExtension(obs.InstanceId.ValueString())
return &dns.ZoneExtensions{
ObservabilityExtension: observabilityExtension,
}, nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personal preference, I like this style more, because you can read which attribute is set with which value and without jumping into the function and checking it there

Suggested change
observabilityExtension := dns.NewZoneObservabilityExtension(obs.InstanceId.ValueString())
return &dns.ZoneExtensions{
ObservabilityExtension: observabilityExtension,
}, nil
return &dns.ZoneExtensions{
ObservabilityExtension: &dns.ZoneObservabilityExtension{
ObservabilityInstanceId: obs.InstanceId.ValueString(),
},
}, nil

ex := extensions{}
diags := model.Extensions.As(ctx, &ex, basetypes.ObjectAsOptions{})
if diags.HasError() {
return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors())
return nil, fmt.Errorf("failed to map extensions to domain type: %w", core.DiagsToError(diags))

obs := observability{}
diags = ex.Observability.As(ctx, &obs, basetypes.ObjectAsOptions{})
if diags.HasError() {
return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return nil, fmt.Errorf("failed to map extensions to domain type: %v", diags.Errors())
return nil, fmt.Errorf("failed to map extensions to domain type: %w", core.DiagsToError(diags))

variable "default_ttl" {}
variable "description" {}
variable "expire_time" {}
variable "ext_observability_instance_id" {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a testing leftover?

Comment on lines +52 to +53
"ext_observability_instance_id": config.StringVariable("a8f823ad-3abb-47fb-b56a-e3a7e97f65d5"),
// "ext_observability_state": config.StringVariable("disabled"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, testing leftover?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DNS Zone Observability Extension

2 participants