feat(cdn): Add skip_dns_check property field - #1727
Conversation
|
Hi @pavlov-tony, |
| Optional: true, | ||
| Computed: true, |
There was a problem hiding this comment.
Setting optional and computed to true can lead to unexpected behavior. At the moment it has the following behavior:
- When the custom domain is created without configuring skip_dns_check -> the API sets it on default to false
- After the creation the skip_dns_check will be set to true -> skip_dns_check is true
- In an additional update the configuration for skip_dns_check will be removed -> Nothing happens. It remains in the last state (independent if it was set to false or true before). I would expect that it will be set to false again like it was in the first step without any configuration
| if val, ok := existingAttrs["skip_dns_check"]; ok { | ||
| certAttributes["skip_dns_check"] = val | ||
| } |
There was a problem hiding this comment.
This isn't necessary here. Within the if clause !model.Certificate.IsNull(), only attributes which are not returned by the API are mapped to certAttributes[""]. But skip_dns_check will be returned by the API and because of it, the actual value from the API should be written to certAttributes (what is already done a few lines below). Otherwise potentially state drifts will not be recognized, if the values in the API has changed.
| if normalizedCert.SkipDnsCheck != nil { | ||
| certAttributes["skip_dns_check"] = types.BoolValue(*normalizedCert.SkipDnsCheck) | ||
| } |
There was a problem hiding this comment.
can be simplified
| if normalizedCert.SkipDnsCheck != nil { | |
| certAttributes["skip_dns_check"] = types.BoolValue(*normalizedCert.SkipDnsCheck) | |
| } | |
| certAttributes["skip_dns_check"] = types.BoolPointerValue(normalizedCert.SkipDnsCheck) |
Description
Adds the
skip_dns_checkfield to theCustom domainresource and datasource.Relates to STACKITCDN-1465
Checklist
make fmtexamples/directory)make generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)