terraform-provider-yandex icon indicating copy to clipboard operation
terraform-provider-yandex copied to clipboard

Error fater update to version v0.92.0

Open kvmukhin opened this issue 1 year ago • 3 comments

Geting error in CDN resource created on provider version 0.89. After updated to version 0.92 and run plan I get 'Error: missing expected {' B tf-state i find "static_request_headers": [], but provider want "static_request_headers": {},

kvmukhin avatar Jun 01 '23 13:06 kvmukhin

Got same error.

evsasha avatar Jun 01 '23 14:06 evsasha

<0.92.0 state

resource "yandex_cdn_resource" "asdfkasdf" {
    active          = true
    cname           = "asdfdasf"
    created_at      = "2023-03-30T11:31:22Z"
    folder_id       = "asdasd"
    id              = "asdasfd"
    origin_group_id = 12345678
    origin_protocol = "https"
    updated_at      = "2023-05-03T13:55:01Z"

    options {
        allowed_http_methods       = [
            "GET",
            "OPTIONS",
            "HEAD",
        ]
        browser_cache_settings     = 0
        cache_http_headers         = [
            "vary",
            "connection",
            "date",
            "content-type",
            "cache-control",
            "content-length",
            "server",
            "etag",
            "age",
        ]
        cors                       = []
        custom_host_header         = "askdfjhkasfdjh"
        disable_cache              = false
        disable_proxy_force_ranges = false
        edge_cache_settings        = 86400
        fetched_compressed         = false
        forward_host_header        = false
        gzip_on                    = true
        ignore_cookie              = true
        ignore_query_params        = true
        proxy_cache_methods_set    = false
        query_params_blacklist     = []
        query_params_whitelist     = []
        redirect_http_to_https     = true
        redirect_https_to_http     = false
        slice                      = false
        static_request_headers     = []
        static_response_headers    = {
            "access-control-allow-methods"  = "GET, HEAD, DELETE, PUT, POST"
            "access-control-allow-origin"   = "*"
            "access-control-expose-headers" = "ETag"
            "strict-transport-security"     = "max-age=31536000"
            "x-content-type-options"        = "nosniff"
            "x-frame-options"               = "SAMEORIGIN"
            "x-xss-protection"              = "1; mode=block"
        }
    }

    ssl_certificate {
        status = "ready"
        type   = "lets_encrypt_gcore"
    }
}

After upgrade

╷
│ Error: Failed to decode resource from state
│
│ Error decoding "yandex_cdn_resource.asdfafs" from previous state: missing expected {
╵
╷
│ Error: missing expected {
│
│   with yandex_cdn_resource.asdfsf,
│   on cdn.tf line 24, in resource "yandex_cdn_resource" "adfadsf":
│   24:   options {
│

bobelev avatar Nov 30 '23 09:11 bobelev

Hi, we are working on this issue.

For a workaround, I can suggest updating yandex_cdn_resource state using the following commands:

terraform state rm yandex_cdn_resource.<YourCNDResourceName>
terraform import yandex_cdn_resource.my_resource <YourCNDResourceId>

PeppaTheC avatar Nov 30 '23 11:11 PeppaTheC