Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yandex_cdn_resource, absent custom_host_header field do not reset this field in CDN resource #365

Open
baznikin opened this issue Aug 16, 2023 · 2 comments
Assignees

Comments

@baznikin
Copy link

If you omit custom_host_header in resource definition any changes made with web console do not affect terraform apply - provider simply ignores it.

Steps to reproduce:

  1. create resource
resource "yandex_cdn_resource" "test" {
  cname = "cdn-kb.example.com"
  origin_protocol = "https"
  origin_group_id = yandex_cdn_origin_group.cdn_kb.id
}
  1. in web console change "main domain name" to custom Host with some value:
    image
  2. terraform apply show nothing changed from provider point of view:
No changes. Your infrastructure matches the configuration.
  1. add custom_host_header to Terraform resource:
resource "yandex_cdn_resource" "test" {
  cname = "cdn-kb.example.com"
  origin_protocol = "https"
  origin_group_id = yandex_cdn_origin_group.cdn_kb.id
  options {
    custom_host_header = "aaa"
  }
}
  1. now terraform apply plan this change:
  # yandex_cdn_resource.cdn_kb will be updated in-place
  ~ resource "yandex_cdn_resource" "test" {
        id              = "bc8tcqvnwrgo3bs6vug3"
        # (7 unchanged attributes hidden)

      ~ options {
          ~ custom_host_header         = "sss" -> "aaa"
            # (20 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

This issue also persist with terraform import of resource with custom host header:

  1. custom_host_header added to state
  2. terraform apply do not plan to remove it if there is no custom_host_header option in resource
@baznikin baznikin changed the title yandex_cdn_resource, absent custom_host_header field do not reset this field in CDR resource yandex_cdn_resource, absent custom_host_header field do not reset this field in CDN resource Aug 16, 2023
@opportunity356 opportunity356 self-assigned this Sep 4, 2024
@opportunity356
Copy link
Contributor

Issue is actual. Reproduces

@baznikin
Copy link
Author

baznikin commented Sep 4, 2024

This is because of common provider (mis)behavior I mentioned in #465 - if there is no value at all in configuration it completly ignore it and do not try to sync

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

No branches or pull requests

2 participants