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

"Resource alicloud_apigateway_api CreateApi Failed" when applying alicloud_apigateway_api for Function Compute 3.0 #7676

Open
bpazdziur opened this issue Sep 17, 2024 · 0 comments

Comments

@bpazdziur
Copy link

Hi,

The alicloud_api_gateway_api resource does not work with Function Compute 3.0. If the service_name in fc_service_config is set to null (which is no longer used in v3.0), an error occurs during terraform apply.

Terraform Version

Terraform v1.5.7
on darwin_amd64

Affected Resource(s)

Please list the resources as a list, for example:

  • alicloud_api_gateway_api

Alicloud Provider version

1.230.0

Terraform Configuration Files

resource "alicloud_api_gateway_api" "example" {
  auth_type         = "ANONYMOUS"
  description       = "api test"
  force_nonce_check = false
  group_id          = "b5a8bea75c36496499e57a33db9d675d"
  name              = "ali-function-compute-api2"
  service_type      = "FunctionCompute"
  stage_names       = ["RELEASE", "TEST"]
  fc_service_config {
    arn_role           = "acs:ram::111111111111:role/aliyunserviceroleforapigateway"
    function_base_url  = null
    function_name      = "event-test"
    function_type      = "FCEvent"
    method             = "GET"
    only_business_path = false
    path               = null
    qualifier          = "LATEST"
    region             = "cn-beijing"
    service_name       = null
    timeout            = 10000
  }
  request_config {
    body_format = "STREAM"
    method      = "POST"
    mode        = "MAPPING_PASSTHROUGH"
    path        = "/fcpath/[fcparam]"
    protocol    = "HTTP,HTTPS"
  }
  request_parameters {
    default_value = null
    description   = null
    in            = "PATH"
    in_service    = "PATH"
    name          = "fcparam"
    name_service  = "fcparam"
    required      = "REQUIRED"
    type          = "STRING"
  }
}

Command Output

alicloud_api_gateway_api.example: Creating...
╷
│ Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_api_gateway_api.go:367: Resource alicloud_apigateway_api CreateApi Failed!!! [SDK alibaba-cloud-sdk-go ERROR]:
│ SDK.ServerError
│ ErrorCode: InvalidFunctionComputeConfig
│ Recommend: https://api.aliyun.com/troubleshoot?q=InvalidFunctionComputeConfig&product=CloudAPI&requestId=05F29797-F6D9-5CA7-B9BE-0F192EBF847E
│ RequestId: 05F29797-F6D9-5CA7-B9BE-0F192EBF847E
│ Message: The specified parameter {"fcBaseUrl":"","fcRegionId":"cn-beijing","fcType":"FCEvent","fcVersion":"2.0","functionName":"event-test","method":"GET","onlyBusinessPath":false,"path":"","qualifier":"LATEST","roleArn":"acs:ram::111111111111:role/aliyunserviceroleforapigateway","serviceName":""} value is not valid.
│ RespHeaders: map[Access-Control-Allow-Origin:[*] Access-Control-Expose-Headers:[*] Connection:[keep-alive] Content-Length:[645] Content-Type:[application/json;charset=utf-8] Date:[Tue, 17 Sep 2024 08:57:59 GMT] Keep-Alive:[timeout=25] X-Acs-Request-Id:[05F29797-F6D9-5CA7-B9BE-0F192EBF847E] X-Acs-Trace-Id:[526b772cee8fc6c789558ca6c3ff5f92]]

Expected Behavior

The API Gateway resource should be successfully applied without requiring service_name in Function Compute 3.0.

Actual Behavior

An error is returned, stating that the value of serviceName is invalid.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Configure alicloud_api_gateway_api with fc_service_config for Function Compute 3.0.
  2. Set service_name in fc_service_config to null.
  3. Run terraform apply.

Important Factoids

Using Function Compute 3.0

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