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

创建ALB转发规则时无法直接创建RemoveHeader转发动作 #7714

Open
MVFrankFan opened this issue Sep 30, 2024 · 0 comments
Open

创建ALB转发规则时无法直接创建RemoveHeader转发动作 #7714

MVFrankFan opened this issue Sep 30, 2024 · 0 comments

Comments

@MVFrankFan
Copy link

Terraform will perform the following actions:

alicloud_alb_rule.this will be created

  • resource "alicloud_alb_rule" "this" {
    • direction = (known after apply)

    • id = (known after apply)

    • listener_id = "lsn-j96vqqsz20eynbnk9u"

    • priority = 1

    • rule_name = "rule1"

    • status = (known after apply)

    • rule_actions {

      • order = 1

      • type = "InsertHeader"

      • insert_header_config {

        • key = "abc"
        • value = "ccc"
        • value_type = "UserDefined"
          }
          }
    • rule_actions {

      • order = 2

      • type = "RemoveHeader"

      • remove_header_config {

        • key = "abcded"
          }
          }
    • rule_actions {

      • order = 3

      • type = "ForwardGroup"

      • forward_group_config {

        • server_group_sticky_session {
          • enabled = false
          • timeout = 300
            }
        • server_group_tuples {
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
      • forward_group_config {

        • server_group_sticky_session {
          • enabled = false
          • timeout = 300
            }
        • server_group_tuples {
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
          • weight = 100
            }
      • forward_group_config {

        • server_group_sticky_session {
          • enabled = false
          • timeout = 300
            }
        • server_group_tuples {
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
          • weight = 100
            }
        • server_group_sticky_session {
          • enabled = false
          • timeout = 300
            }
        • server_group_tuples {
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
          • weight = 100
            }
          • timeout = 300
            }
        • server_group_tuples {
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
          • weight = 100
            }
        • server_group_tuples {
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
          • weight = 100
            }
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
          • weight = 100
            }
            }
            }
          • weight = 100
            }
            }
            }

        }
        }

    • rule_conditions {

      • type = "Cookie"

      • type = "Cookie"

        • values {
          • key = "abc"
          • value = "abc"
            }
            }
            }
            }

Plan: 1 to add, 0 to change, 0 to destroy.
alicloud_alb_rule.this: Creating...

│ Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_alb_rule.go:808: Resource alicloud_alb_rule CreateRule Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
│ SDKError:
│ StatusCode: 400
│ Code: MissingParam.RemoveHeaderConfig
│ Message: code: 400, The param of RuleActions.1.RemoveHeaderConfig is missing. request id: 2B919A60-9966-5FD6-8A78-842EC90AE5B9
│ Data: {"Code":"MissingParam.RemoveHeaderConfig","HostId":"alb.cn-shanghai.aliyuncs.com","Message":"The param of RuleActions.1.RemoveHeaderConfig is missing.","Recommend":"https://api.aliyun.com/troubleshoot?q=MissingParam.RemoveHeaderConfig&product=Alb&requestId=2B919A60-9966-5FD6-8A78-842EC90AE5B9","RequestId":"2B919A60-9966-5FD6-8A78-842EC90AE5B9"}


│ with alicloud_alb_rule.this,
│ on alb_rule.tf line 5, in resource "alicloud_alb_rule" "this":
│ 5: resource "alicloud_alb_rule" "this" {

以上信息是terraform apply时的信息,plan并未有任何错误信息,但是说RuleActions.1.RemoveHeaderConfig is missing,实际是有参数的

此时我拿掉RemoveHeader转发动作,即可创建资源
Terraform will perform the following actions:

alicloud_alb_rule.this will be created

  • resource "alicloud_alb_rule" "this" {
    • direction = (known after apply)

    • id = (known after apply)

    • listener_id = "lsn-j96vqqsz20eynbnk9u"

    • priority = 1

    • rule_name = "rule1"

    • status = (known after apply)

    • rule_actions {

      • order = 1

      • type = "InsertHeader"

      • insert_header_config {

        • key = "abc"
        • value = "ccc"
        • value_type = "UserDefined"
          }
          }
    • rule_actions {

      • order = 3

      • type = "ForwardGroup"

      • forward_group_config {

        • server_group_sticky_session {
          • enabled = false
          • timeout = 300
            }
        • server_group_tuples {
          • server_group_id = "sgp-vt57bcgip5iodqmcdx"
          • weight = 100
            }
            }
            }
    • rule_conditions {

      • type = "Cookie"

      • cookie_config {

        • values {
          • key = "abc"
          • value = "abc"
            }
            }
            }
            }

Plan: 1 to add, 0 to change, 0 to destroy.
alicloud_alb_rule.this: Creating...
alicloud_alb_rule.this: Creation complete after 6s [id=rule-m3rtujx3wwotuwzq1n]

在rule创建成功以后,我把RemoveHeader动作加回去,才能创建成功
Terraform will perform the following actions:

alicloud_alb_rule.this will be updated in-place

~ resource "alicloud_alb_rule" "this" {
id = "rule-m3rtujx3wwotuwzq1n"
# (5 unchanged attributes hidden)

  - rule_actions {
      - order = 3 -> null
      - type  = "ForwardGroup" -> null

      - forward_group_config {
          - server_group_sticky_session {
              - enabled = false -> null
              - timeout = 0 -> null
            }
          - server_group_tuples {
              - server_group_id = "sgp-vt57bcgip5iodqmcdx" -> null
              - weight          = 100 -> null
            }
        }
    }
  + rule_actions {
      + order = 2
      + type  = "RemoveHeader"

      + remove_header_config {
          + key = "abcded"
        }
    }
  + rule_actions {
      + order = 3
      + type  = "ForwardGroup"

      + forward_group_config {
          + server_group_sticky_session {
              + enabled = false
              + timeout = 300
            }
          + server_group_tuples {
              + server_group_id = "sgp-vt57bcgip5iodqmcdx"
              + weight          = 100
            }
        }
    }

    # (2 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.
alicloud_alb_rule.this: Modifying... [id=rule-m3rtujx3wwotuwzq1n]
alicloud_alb_rule.this: Modifications complete after 6s [id=rule-m3rtujx3wwotuwzq1n]

目测是SDK里面的问题,因为手工操作没碰到这种问题.

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

No branches or pull requests

1 participant