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

Actions fail to import for ibm_cis_page_rule resources #2765

Closed
rmoe opened this issue Jun 21, 2021 · 8 comments
Closed

Actions fail to import for ibm_cis_page_rule resources #2765

rmoe opened this issue Jun 21, 2021 · 8 comments
Assignees
Labels
service/Internet Services Issues related to Cloud Internet Service (CIS)

Comments

@rmoe
Copy link

rmoe commented Jun 21, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform IBM Provider Version

$ terraform -v
Terraform v0.13.7
+ provider registry.terraform.io/ibm-cloud/ibm v1.26.2

Affected Resource(s)

  • ibm_cis_page_rule

Terraform Configuration Files

We have defined some ibm_cis_page_rule resources so that we can import existing page rules. This is one example:

resource "ibm_cis_page_rule" "page_rule_1" {
 ...
  targets {
    target = "url"
    constraint {
      operator = "matches"
      value    = "domain.com/*"
    }
  }
  actions {
    id    = "browser_cache_ttl"
    value = "30"
  }

  actions {
    id    = "serve_stale_content"
    value = "off"
  }

  actions {
    id = "disable_performance"
  }
}

here is the corresponding page rule as it currently exists:

    {       
      "targets": [
            {
                "target": "url",
                "constraint": {
                    "operator": "matches",
                    "value": "domain.com/*"
                }
            }
        ],
        "actions": [
            {
                "id": "browser_cache_ttl",
                "value": 30
            },
            {
                "id": "serve_stale_content",
                "value": "off"
            },
            {
                "id": "disable_performance"
            }
        ],
        "status": "active",
        "priority": 3
    }

Expected Behavior

When we import page rules the actions are also imported.

Actual Behavior

Page rule actions are not always being imported. In the case of the above resource it imports correctly but with no actions defined.

$ terraform state show ibm_cis_page_rule.page_rule_1
# ibm_cis_page_rule.page_rule_1:
resource "ibm_cis_page_rule" "page_rule_1" {
    priority  = 3
    status    = "active"

    targets {
        target = "url"

        constraint {
            operator = "matches"
            value    = "domain.com/*"
        }
    }
}

The issue seems to be a type error related to the browser_cache_ttl action.

2021-06-21T14:07:05.556-0700 [INFO]  plugin.terraform-provider-ibm_v1.26.2: 2021/06/21 14:07:05 [ERROR] setting state: actions.0.value: '' expected type 'string', got unconvertible type 'float64', value: '30': timestamp=2021-06-21T14:07:05.555-0700

A similar thing happens to any page rule with a minify action:

2021-06-21T14:18:03.990-0700 [INFO]  plugin.terraform-provider-ibm_v1.26.2: 2021/06/21 14:18:03 [ERROR] setting state: actions.0.value: '' expected type 'string', got unconvertible type 'map[string]interface {}', value: 'map[css:off html:off js:off]': timestamp=2021-06-21T14:18:03.989-0700

Steps to Reproduce

  1. Import a page rule with either a minify or browser_cache_ttl action.
  2. terraform state show ibm_cis_page_rule.imported_page_rule and see that no actions exist.
@kavya498
Copy link
Collaborator

@rmoe , Can we get complete logs..
and which version of provider is been used here?

Thanks

@kavya498 kavya498 added the service/Internet Services Issues related to Cloud Internet Service (CIS) label Jun 22, 2021
@rmoe
Copy link
Author

rmoe commented Jun 22, 2021

$ terraform -v
Terraform v0.13.7
+ provider registry.terraform.io/ibm-cloud/ibm v1.26.2

https://gist.github.com/rmoe/9adb558638aab0fe014f10b2e8e22e03

@kavya498
Copy link
Collaborator

@MalarvizhiK ,
Can you please look into this issue?
Looks like type conversion is not handled here

@MalarvizhiK
Copy link
Member

@shivaleelac Please look into this.

@bstoutenburgh
Copy link

Has this gotten dropped between handoffs?

@MalarvizhiK
Copy link
Member

Shivaleela will look at the defect and let us know the timeline

@MalarvizhiK
Copy link
Member

Shivaleela and Sandeep S from PDNS team will work on this issue.

hkantare pushed a commit that referenced this issue Dec 6, 2021
* [Resolved]Actions fail to import for ibm_cis_page_rule resources #2765

* updated ibm_cis_page_rule resources

* update cis_page_rules docs

Co-authored-by: Sandeep-S1 <[email protected]>
@kavya498
Copy link
Collaborator

Fix is available in provider version >=1.37.0
Closing this issue..
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/Internet Services Issues related to Cloud Internet Service (CIS)
Projects
None yet
Development

No branches or pull requests

4 participants