diff --git a/docs/data-sources/dns_zone.md b/docs/data-sources/dns_zone.md
index 9ca361d29..c3c247abc 100644
--- a/docs/data-sources/dns_zone.md
+++ b/docs/data-sources/dns_zone.md
@@ -40,6 +40,7 @@ data "stackit_dns_zone" "example" {
- `default_ttl` (Number) Default time to live.
- `description` (String) Description of the zone.
- `expire_time` (Number) Expire time.
+- `extensions` (Attributes) A single extensions block as defined below. (see [below for nested schema](#nestedatt--extensions))
- `id` (String) Terraform's internal data source. ID. It is structured as "`project_id`,`zone_id`".
- `is_reverse_zone` (Boolean) Specifies, if the zone is a reverse zone or not.
- `name` (String) The user given name of the zone.
@@ -60,3 +61,19 @@ data "stackit_dns_zone" "example" {
Optional:
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
+
+
+
+### Nested Schema for `extensions`
+
+Read-Only:
+
+- `observability` (Attributes) A single observability block as defined below. (see [below for nested schema](#nestedatt--extensions--observability))
+
+
+### Nested Schema for `extensions.observability`
+
+Read-Only:
+
+- `observability_instance_id` (String) Observability instance ID to choose which Observability instance is used.
+- `state` (String) State of the observability extension.
diff --git a/docs/resources/dns_zone.md b/docs/resources/dns_zone.md
index b5dd0706d..414200469 100644
--- a/docs/resources/dns_zone.md
+++ b/docs/resources/dns_zone.md
@@ -48,6 +48,7 @@ import {
- `default_ttl` (Number) Default time to live. E.g. 3600.
- `description` (String) Description of the zone.
- `expire_time` (Number) Expire time. E.g. 1209600.
+- `extensions` (Attributes) A single extensions block as defined below. (see [below for nested schema](#nestedatt--extensions))
- `is_reverse_zone` (Boolean) Specifies, if the zone is a reverse zone or not. Defaults to `false`
- `negative_cache` (Number) Negative caching. E.g. 60
- `primaries` (List of String) Primary name server for secondary zone. E.g. ["1.2.3.4"]
@@ -66,6 +67,26 @@ import {
- `visibility` (String) Visibility of the zone. E.g. `public`.
- `zone_id` (String) The zone ID.
+
+### Nested Schema for `extensions`
+
+Optional:
+
+- `observability` (Attributes) A single observability block as defined below. (see [below for nested schema](#nestedatt--extensions--observability))
+
+
+### Nested Schema for `extensions.observability`
+
+Required:
+
+- `observability_instance_id` (String) Observability instance ID to choose which Observability instance is used.
+
+Read-Only:
+
+- `state` (String) State of the extension.
+
+
+
### Nested Schema for `timeouts`
diff --git a/stackit/internal/services/dns/dns_acc_test.go b/stackit/internal/services/dns/dns_acc_test.go
index 9b451893e..c08255836 100644
--- a/stackit/internal/services/dns/dns_acc_test.go
+++ b/stackit/internal/services/dns/dns_acc_test.go
@@ -40,15 +40,17 @@ var testConfigVarsMin = config.Variables{
}
var testConfigVarsMax = config.Variables{
- "project_id": config.StringVariable(testutil.ProjectId),
- "name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
- "dns_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha) + ".example.home"),
- "acl": config.StringVariable("0.0.0.0/0"),
- "active": config.BoolVariable(true),
- "contact_email": config.StringVariable("contact@example.com"),
- "default_ttl": config.IntegerVariable(3600),
- "description": config.StringVariable("a test description"),
- "expire_time": config.IntegerVariable(1 * 24 * 60 * 60),
+ "project_id": config.StringVariable(testutil.ProjectId),
+ "name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
+ "dns_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha) + ".example.home"),
+ "acl": config.StringVariable("0.0.0.0/0"),
+ "active": config.BoolVariable(true),
+ "contact_email": config.StringVariable("contact@example.com"),
+ "default_ttl": config.IntegerVariable(3600),
+ "description": config.StringVariable("a test description"),
+ "expire_time": config.IntegerVariable(1 * 24 * 60 * 60),
+ "ext_observability_instance_id": config.StringVariable("a8f823ad-3abb-47fb-b56a-e3a7e97f65d5"),
+ // "ext_observability_state": config.StringVariable("disabled"),
"is_reverse_zone": config.BoolVariable(false),
// "negative_cache": config.IntegerVariable(128),
"primaries": config.ListVariable(config.StringVariable("1.1.1.1")),
@@ -56,12 +58,14 @@ var testConfigVarsMax = config.Variables{
"retry_time": config.IntegerVariable(600),
"type": config.StringVariable("primary"),
- "record_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
- "record_record1": config.StringVariable("1.2.3.4"),
- "record_active": config.BoolVariable(true),
- "record_comment": config.StringVariable("a test comment"),
- "record_ttl": config.IntegerVariable(3600),
- "record_type": config.StringVariable("A"),
+ "record_name": config.StringVariable("tf-acc-" + acctest.RandStringFromCharSet(8, acctest.CharSetAlpha)),
+ "record_record1": config.StringVariable("1.2.3.4"),
+ "record_active": config.BoolVariable(true),
+ "record_comment": config.StringVariable("a test comment"),
+ "record_ttl": config.IntegerVariable(3600),
+ "record_type": config.StringVariable("A"),
+ "observability_instance_name": config.StringVariable(fmt.Sprintf("tf-acc-i%s", acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum))),
+ "observability_plan_name": config.StringVariable("Observability-Metrics-Endpoint-100k-EU01"),
}
func configVarsInvalid(vars config.Variables) config.Variables {
@@ -313,6 +317,9 @@ func TestAccDnsMaxResource(t *testing.T) {
resource.TestCheckResourceAttr("stackit_dns_record_set.record_set", "type", testutil.ConvertConfigVariable(testConfigVarsMax["record_type"])),
resource.TestCheckResourceAttrSet("stackit_dns_record_set.record_set", "fqdn"),
resource.TestCheckResourceAttrSet("stackit_dns_record_set.record_set", "state"),
+
+ resource.TestCheckResourceAttr("stackit_observability_instance.observability_instance", "name", testutil.ConvertConfigVariable(testConfigVarsMax["observability_instance_name"])),
+ resource.TestCheckResourceAttr("stackit_observability_instance.observability_instance", "plan_name", testutil.ConvertConfigVariable(testConfigVarsMax["observability_plan_name"])),
),
},
// Data sources
@@ -404,6 +411,9 @@ func TestAccDnsMaxResource(t *testing.T) {
resource.TestCheckResourceAttr("data.stackit_dns_record_set.record_set", "comment", testutil.ConvertConfigVariable(testConfigVarsMax["record_comment"])),
resource.TestCheckResourceAttr("data.stackit_dns_record_set.record_set", "ttl", testutil.ConvertConfigVariable(testConfigVarsMax["record_ttl"])),
resource.TestCheckResourceAttr("data.stackit_dns_record_set.record_set", "type", testutil.ConvertConfigVariable(testConfigVarsMax["record_type"])),
+
+ resource.TestCheckResourceAttr("stackit_observability_instance.observability_instance", "name", testutil.ConvertConfigVariable(testConfigVarsMax["observability_instance_name"])),
+ resource.TestCheckResourceAttr("stackit_observability_instance.observability_instance", "plan_name", testutil.ConvertConfigVariable(testConfigVarsMax["observability_plan_name"])),
),
},
// Import
@@ -492,7 +502,11 @@ func TestAccDnsMaxResource(t *testing.T) {
resource.TestCheckResourceAttr("stackit_dns_record_set.record_set", "ttl", testutil.ConvertConfigVariable(testConfigVarsMax["record_ttl"])),
resource.TestCheckResourceAttr("stackit_dns_record_set.record_set", "type", testutil.ConvertConfigVariable(testConfigVarsMax["record_type"])),
resource.TestCheckResourceAttrSet("stackit_dns_record_set.record_set", "fqdn"),
- resource.TestCheckResourceAttrSet("stackit_dns_record_set.record_set", "state")),
+ resource.TestCheckResourceAttrSet("stackit_dns_record_set.record_set", "state"),
+
+ resource.TestCheckResourceAttr("stackit_observability_instance.observability_instance", "name", testutil.ConvertConfigVariable(testConfigVarsMax["observability_instance_name"])),
+ resource.TestCheckResourceAttr("stackit_observability_instance.observability_instance", "plan_name", testutil.ConvertConfigVariable(testConfigVarsMax["observability_plan_name"])),
+ ),
},
// Deletion is done by the framework implicitly
},
diff --git a/stackit/internal/services/dns/testdata/resource-max.tf b/stackit/internal/services/dns/testdata/resource-max.tf
index 135e3b5ec..3f1a4b75c 100644
--- a/stackit/internal/services/dns/testdata/resource-max.tf
+++ b/stackit/internal/services/dns/testdata/resource-max.tf
@@ -7,6 +7,7 @@ variable "contact_email" {}
variable "default_ttl" {}
variable "description" {}
variable "expire_time" {}
+variable "ext_observability_instance_id" {}
variable "is_reverse_zone" {}
# variable "negative_cache" {}
variable "primaries" {}
@@ -21,19 +22,31 @@ variable "record_comment" {}
variable "record_ttl" {}
variable "record_type" {}
+variable "observability_instance_name" {}
+variable "observability_plan_name" {}
+resource "stackit_observability_instance" "observability_instance" {
+ project_id = var.project_id
+ name = var.observability_instance_name
+ plan_name = var.observability_plan_name
+}
resource "stackit_dns_zone" "zone" {
- project_id = var.project_id
- name = var.name
- dns_name = var.dns_name
- acl = var.acl
- active = var.active
- contact_email = var.contact_email
- default_ttl = var.default_ttl
- description = var.description
- expire_time = var.expire_time
+ project_id = var.project_id
+ name = var.name
+ dns_name = var.dns_name
+ acl = var.acl
+ active = var.active
+ contact_email = var.contact_email
+ default_ttl = var.default_ttl
+ description = var.description
+ expire_time = var.expire_time
+ extensions = {
+ observability = {
+ observability_instance_id = stackit_observability_instance.observability_instance.instance_id
+ }
+ }
is_reverse_zone = var.is_reverse_zone
# negative_cache = var.negative_cache
primaries = var.primaries
diff --git a/stackit/internal/services/dns/zone/datasource.go b/stackit/internal/services/dns/zone/datasource.go
index 7e58a7ec7..f8fdc1f07 100644
--- a/stackit/internal/services/dns/zone/datasource.go
+++ b/stackit/internal/services/dns/zone/datasource.go
@@ -139,6 +139,26 @@ func (d *zoneDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest,
Description: "Expire time.",
Computed: true,
},
+ "extensions": schema.SingleNestedAttribute{
+ Description: "A single extensions block as defined below.",
+ Computed: true,
+ Attributes: map[string]schema.Attribute{
+ "observability": schema.SingleNestedAttribute{
+ Description: "A single observability block as defined below.",
+ Computed: true,
+ Attributes: map[string]schema.Attribute{
+ "observability_instance_id": schema.StringAttribute{
+ Description: "Observability instance ID to choose which Observability instance is used.",
+ Computed: true,
+ },
+ "state": schema.StringAttribute{
+ Description: "State of the observability extension.",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
"is_reverse_zone": schema.BoolAttribute{
Description: "Specifies, if the zone is a reverse zone or not.",
Computed: true,
diff --git a/stackit/internal/services/dns/zone/resource.go b/stackit/internal/services/dns/zone/resource.go
index d0e00d0b6..16a086b53 100644
--- a/stackit/internal/services/dns/zone/resource.go
+++ b/stackit/internal/services/dns/zone/resource.go
@@ -16,15 +16,18 @@ import (
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
dns "github.com/stackitcloud/stackit-sdk-go/services/dns/v1api"
@@ -58,6 +61,7 @@ type Model struct {
ContactEmail types.String `tfsdk:"contact_email"`
DefaultTTL types.Int32 `tfsdk:"default_ttl"`
ExpireTime types.Int32 `tfsdk:"expire_time"`
+ Extensions types.Object `tfsdk:"extensions"`
IsReverseZone types.Bool `tfsdk:"is_reverse_zone"`
NegativeCache types.Int32 `tfsdk:"negative_cache"`
PrimaryNameServer types.String `tfsdk:"primary_name_server"`
@@ -86,6 +90,29 @@ type zoneResource struct {
client *dns.APIClient
}
+// Struct corresponding to Model.Extensions
+type extensions struct {
+ Observability types.Object `tfsdk:"observability"`
+}
+
+// Struct corresponding to extensions.Observability
+type observability struct {
+ InstanceId types.String `tfsdk:"observability_instance_id"`
+ // State is response only
+ State types.String `tfsdk:"state"`
+}
+
+// Types corresponding to extensions
+var extensionsTypes = map[string]attr.Type{
+ "observability": basetypes.ObjectType{AttrTypes: observabilityTypes},
+}
+
+// Types corresponding to observability
+var observabilityTypes = map[string]attr.Type{
+ "observability_instance_id": basetypes.StringType{},
+ "state": basetypes.StringType{},
+}
+
// Metadata returns the resource type name.
func (r *zoneResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_dns_zone"
@@ -210,6 +237,30 @@ func (r *zoneResource) Schema(ctx context.Context, _ resource.SchemaRequest, res
int32validator.Between(60, 99999999),
},
},
+
+ "extensions": schema.SingleNestedAttribute{
+ Description: "A single extensions block as defined below.",
+ Optional: true,
+ PlanModifiers: []planmodifier.Object{
+ objectplanmodifier.UseStateForUnknown(),
+ },
+ Attributes: map[string]schema.Attribute{
+ "observability": schema.SingleNestedAttribute{
+ Description: "A single observability block as defined below.",
+ Optional: true,
+ Attributes: map[string]schema.Attribute{
+ "observability_instance_id": schema.StringAttribute{
+ Description: "Observability instance ID to choose which Observability instance is used.",
+ Required: true,
+ },
+ "state": schema.StringAttribute{
+ Description: "State of the extension.",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
"is_reverse_zone": schema.BoolAttribute{
Description: "Specifies, if the zone is a reverse zone or not. Defaults to `false`",
Optional: true,
@@ -319,7 +370,7 @@ func (r *zoneResource) Create(ctx context.Context, req resource.CreateRequest, r
ctx = tflog.SetField(ctx, "project_id", projectId)
// Generate API request body from model
- payload, err := toCreatePayload(&model.Model)
+ payload, err := toCreatePayload(ctx, &model.Model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating zone", fmt.Sprintf("Creating API payload: %v", err))
return
@@ -452,7 +503,7 @@ func (r *zoneResource) Update(ctx context.Context, req resource.UpdateRequest, r
ctx = tflog.SetField(ctx, "zone_id", zoneId)
// Generate API request body from model
- payload, err := toUpdatePayload(&model.Model)
+ payload, err := toUpdatePayload(ctx, &model.Model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Creating API payload: %v", err))
return
@@ -555,6 +606,37 @@ func (r *zoneResource) ImportState(ctx context.Context, req resource.ImportState
tflog.Info(ctx, "DNS zone state imported")
}
+func mapExtensions(z *dns.ZoneResponse, m *Model) error {
+ if z.Zone.Extensions == nil {
+ m.Extensions = types.ObjectNull(extensionsTypes)
+ return nil
+ }
+
+ if z.Zone.Extensions.ObservabilityExtension != nil {
+ state := types.StringValue(*z.Zone.Extensions.ObservabilityExtension.State)
+ observabilityInstanceId := types.StringValue(z.Zone.Extensions.ObservabilityExtension.ObservabilityInstanceId)
+
+ observabilityValues := map[string]attr.Value{
+ "state": state,
+ "observability_instance_id": observabilityInstanceId,
+ }
+ observabilityExtension, diags := types.ObjectValue(observabilityTypes, observabilityValues)
+ if diags.HasError() {
+ return fmt.Errorf("creating observability extension: %w", core.DiagsToError(diags))
+ }
+ extensionValue := map[string]attr.Value{
+ "observability": observabilityExtension,
+ }
+
+ extensions, diags := types.ObjectValue(extensionsTypes, extensionValue)
+ if diags.HasError() {
+ return fmt.Errorf("creating extensions: %w", core.DiagsToError(diags))
+ }
+ m.Extensions = extensions
+ }
+ return nil
+}
+
func mapFields(ctx context.Context, zoneResp *dns.ZoneResponse, model *Model) error {
if zoneResp == nil {
return fmt.Errorf("response input is nil")
@@ -620,10 +702,11 @@ func mapFields(ctx context.Context, zoneResp *dns.ZoneResponse, model *Model) er
model.State = types.StringValue(string(z.State))
model.Type = types.StringValue(string(z.Type))
model.Visibility = types.StringValue(string(z.Visibility))
- return nil
+
+ return mapExtensions(zoneResp, model)
}
-func toCreatePayload(model *Model) (*dns.CreateZonePayload, error) {
+func toCreatePayload(ctx context.Context, model *Model) (*dns.CreateZonePayload, error) {
if model == nil {
return nil, fmt.Errorf("nil model")
}
@@ -636,6 +719,11 @@ func toCreatePayload(model *Model) (*dns.CreateZonePayload, error) {
}
modelPrimaries = append(modelPrimaries, primaryString.ValueString())
}
+
+ ext, err := getExtensionsPayload(ctx, model)
+ if err != nil {
+ return nil, fmt.Errorf("could not map extensions to create payload: %w", err)
+ }
return &dns.CreateZonePayload{
Name: model.Name.ValueString(),
DnsName: model.DnsName.ValueString(),
@@ -645,6 +733,7 @@ func toCreatePayload(model *Model) (*dns.CreateZonePayload, error) {
Type: conversion.StringValueToEnumPointer[dns.CreateZonePayloadType](model.Type),
DefaultTTL: conversion.Int32ValueToPointer(model.DefaultTTL),
ExpireTime: conversion.Int32ValueToPointer(model.ExpireTime),
+ Extensions: ext,
RefreshTime: conversion.Int32ValueToPointer(model.RefreshTime),
RetryTime: conversion.Int32ValueToPointer(model.RetryTime),
NegativeCache: conversion.Int32ValueToPointer(model.NegativeCache),
@@ -653,11 +742,15 @@ func toCreatePayload(model *Model) (*dns.CreateZonePayload, error) {
}, nil
}
-func toUpdatePayload(model *Model) (*dns.PartialUpdateZonePayload, error) {
+func toUpdatePayload(ctx context.Context, model *Model) (*dns.PartialUpdateZonePayload, error) {
if model == nil {
return nil, fmt.Errorf("nil model")
}
+ ext, err := getExtensionsPayload(ctx, model)
+ if err != nil {
+ return nil, fmt.Errorf("could not map extensions to update payload: %w", err)
+ }
return &dns.PartialUpdateZonePayload{
Name: conversion.StringValueToPointer(model.Name),
ContactEmail: conversion.StringValueToPointer(model.ContactEmail),
@@ -665,9 +758,35 @@ func toUpdatePayload(model *Model) (*dns.PartialUpdateZonePayload, error) {
Acl: conversion.StringValueToPointer(model.Acl),
DefaultTTL: conversion.Int32ValueToPointer(model.DefaultTTL),
ExpireTime: conversion.Int32ValueToPointer(model.ExpireTime),
+ Extensions: ext,
RefreshTime: conversion.Int32ValueToPointer(model.RefreshTime),
RetryTime: conversion.Int32ValueToPointer(model.RetryTime),
NegativeCache: conversion.Int32ValueToPointer(model.NegativeCache),
Primaries: nil, // API returns error if this field is set, even if nothing changes
}, nil
}
+
+// 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) {
+ if !utils.IsUndefined(model.Extensions) {
+ 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())
+ }
+ if !utils.IsUndefined(ex.Observability) {
+ 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())
+ }
+ observabilityExtension := dns.NewZoneObservabilityExtension(obs.InstanceId.ValueString())
+ return &dns.ZoneExtensions{
+ ObservabilityExtension: observabilityExtension,
+ }, nil
+ }
+ return &dns.ZoneExtensions{}, nil
+ }
+ return nil, nil
+}
diff --git a/stackit/internal/services/dns/zone/resource_test.go b/stackit/internal/services/dns/zone/resource_test.go
index 2f2bde114..497dc3f6b 100644
--- a/stackit/internal/services/dns/zone/resource_test.go
+++ b/stackit/internal/services/dns/zone/resource_test.go
@@ -317,15 +317,21 @@ func TestToCreatePayload(t *testing.T) {
{
"mapping_with_conversions_ok",
&Model{
- Name: types.StringValue("Name"),
- DnsName: types.StringValue("DnsName"),
- Acl: types.StringValue("Acl"),
- Description: types.StringValue("Description"),
- Type: types.StringValue("primary"),
- ContactEmail: types.StringValue("ContactEmail"),
- RetryTime: types.Int32Value(3),
- RefreshTime: types.Int32Value(4),
- ExpireTime: types.Int32Value(5),
+ Name: types.StringValue("Name"),
+ DnsName: types.StringValue("DnsName"),
+ Acl: types.StringValue("Acl"),
+ Description: types.StringValue("Description"),
+ Type: types.StringValue("primary"),
+ ContactEmail: types.StringValue("ContactEmail"),
+ RetryTime: types.Int32Value(3),
+ RefreshTime: types.Int32Value(4),
+ ExpireTime: types.Int32Value(5),
+ Extensions: types.ObjectValueMust(extensionsTypes, map[string]attr.Value{
+ "observability": types.ObjectValueMust(observabilityTypes, map[string]attr.Value{
+ "observability_instance_id": types.StringValue("some UUID"),
+ "state": types.StringNull(),
+ }),
+ }),
DefaultTTL: types.Int32Value(4534534),
NegativeCache: types.Int32Value(-4534534),
Primaries: types.ListValueMust(types.StringType, []attr.Value{
@@ -334,16 +340,21 @@ func TestToCreatePayload(t *testing.T) {
IsReverseZone: types.BoolValue(true),
},
&dns.CreateZonePayload{
- Name: "Name",
- DnsName: "DnsName",
- Acl: new("Acl"),
- Description: new("Description"),
- Type: new(dns.CREATEZONEPAYLOADTYPE_PRIMARY),
- ContactEmail: new("ContactEmail"),
- Primaries: []string{"primary"},
- RetryTime: new(int32(3)),
- RefreshTime: new(int32(4)),
- ExpireTime: new(int32(5)),
+ Name: "Name",
+ DnsName: "DnsName",
+ Acl: new("Acl"),
+ Description: new("Description"),
+ Type: new(dns.CREATEZONEPAYLOADTYPE_PRIMARY),
+ ContactEmail: new("ContactEmail"),
+ Primaries: []string{"primary"},
+ RetryTime: new(int32(3)),
+ RefreshTime: new(int32(4)),
+ ExpireTime: new(int32(5)),
+ Extensions: &dns.ZoneExtensions{
+ ObservabilityExtension: &dns.ZoneObservabilityExtension{
+ ObservabilityInstanceId: "some UUID",
+ },
+ },
DefaultTTL: new(int32(4534534)),
NegativeCache: new(int32(-4534534)),
IsReverseZone: new(true),
@@ -359,7 +370,7 @@ func TestToCreatePayload(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
- output, err := toCreatePayload(tt.input)
+ output, err := toCreatePayload(t.Context(), tt.input)
if !tt.isValid && err == nil {
t.Fatalf("Should have failed")
}
@@ -430,7 +441,7 @@ func TestToPayloadUpdate(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.description, func(t *testing.T) {
- output, err := toUpdatePayload(tt.input)
+ output, err := toUpdatePayload(t.Context(), tt.input)
if !tt.isValid && err == nil {
t.Fatalf("Should have failed")
}