diff --git a/CHANGELOG.md b/CHANGELOG.md index 63c0875f..cdf9a253 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.1 (unreleased) + +- Fix idempotency issue with DNS redirect configuration of `sdwan_traffic_data_policy_definition` resource + ## 0.3.0 - Add `sdwan_system_feature_profile` resource and data source diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 863fc356..3a32e9be 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.3.1 (unreleased) + +- Fix idempotency issue with DNS redirect configuration of `sdwan_traffic_data_policy_definition` resource + ## 0.3.0 - Add `sdwan_system_feature_profile` resource and data source diff --git a/gen/definitions/generic/traffic_data_policy_definition.yaml b/gen/definitions/generic/traffic_data_policy_definition.yaml index d32c4d9f..52e0bdf7 100644 --- a/gen/definitions/generic/traffic_data_policy_definition.yaml +++ b/gen/definitions/generic/traffic_data_policy_definition.yaml @@ -419,8 +419,8 @@ attributes: data_path: [parameter] tf_name: redirect_dns_type conditional_attribute: - name: type - value: redirectDns + name: redirect_dns + value: dnsType type: String enum_values: [host, umbrella] description: Redirect DNS type @@ -430,8 +430,8 @@ attributes: data_path: [parameter] tf_name: redirect_dns_address conditional_attribute: - name: type - value: redirectDns + name: redirect_dns + value: ipAddress type: String description: Redirect DNS IP address example: 10.1.1.1 diff --git a/internal/provider/model_sdwan_traffic_data_policy_definition.go b/internal/provider/model_sdwan_traffic_data_policy_definition.go index ae5edf60..b226a5af 100644 --- a/internal/provider/model_sdwan_traffic_data_policy_definition.go +++ b/internal/provider/model_sdwan_traffic_data_policy_definition.go @@ -272,10 +272,10 @@ func (data TrafficDataPolicyDefinition) toBody(ctx context.Context) string { if !childItem.RedirectDns.IsNull() && childItem.Type.ValueString() == "redirectDns" { itemChildBody, _ = sjson.Set(itemChildBody, "parameter.field", childItem.RedirectDns.ValueString()) } - if !childItem.RedirectDnsType.IsNull() && childItem.Type.ValueString() == "redirectDns" { + if !childItem.RedirectDnsType.IsNull() && childItem.RedirectDns.ValueString() == "dnsType" { itemChildBody, _ = sjson.Set(itemChildBody, "parameter.value", childItem.RedirectDnsType.ValueString()) } - if !childItem.RedirectDnsAddress.IsNull() && childItem.Type.ValueString() == "redirectDns" { + if !childItem.RedirectDnsAddress.IsNull() && childItem.RedirectDns.ValueString() == "ipAddress" { itemChildBody, _ = sjson.Set(itemChildBody, "parameter.value", childItem.RedirectDnsAddress.ValueString()) } if !childItem.ServiceNodeGroup.IsNull() && childItem.Type.ValueString() == "serviceNodeGroup" { @@ -635,12 +635,12 @@ func (data *TrafficDataPolicyDefinition) fromBody(ctx context.Context, res gjson } else { cItem.RedirectDns = types.StringNull() } - if ccValue := cv.Get("parameter.value"); ccValue.Exists() && cItem.Type.ValueString() == "redirectDns" { + if ccValue := cv.Get("parameter.value"); ccValue.Exists() && cItem.RedirectDns.ValueString() == "dnsType" { cItem.RedirectDnsType = types.StringValue(ccValue.String()) } else { cItem.RedirectDnsType = types.StringNull() } - if ccValue := cv.Get("parameter.value"); ccValue.Exists() && cItem.Type.ValueString() == "redirectDns" { + if ccValue := cv.Get("parameter.value"); ccValue.Exists() && cItem.RedirectDns.ValueString() == "ipAddress" { cItem.RedirectDnsAddress = types.StringValue(ccValue.String()) } else { cItem.RedirectDnsAddress = types.StringNull() diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 863fc356..3a32e9be 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.3.1 (unreleased) + +- Fix idempotency issue with DNS redirect configuration of `sdwan_traffic_data_policy_definition` resource + ## 0.3.0 - Add `sdwan_system_feature_profile` resource and data source