FlexibleEngineCloud / terraform-provider-flexibleengine

Terraform flexibleengine provider
https://www.terraform.io/docs/providers/flexibleengine/
Mozilla Public License 2.0
30 stars 53 forks source link

[CSS] the service creation failed, due to snapshot error #395

Closed jpichon-OCB closed 3 years ago

jpichon-OCB commented 4 years ago

I try to create a CSS service with terraform.

With provider version 1.13.0, the service is created without issue. With version 1.14.0 to 1.16.0, the terraform plan exits with snapshot error.

I don't configure backup in my CSS ressource. So, it's not normal to get snapshot service error.

Terraform Version

v0.13.2

Affected Resource(s)

CSS service

Terraform Configuration Files

resource flexibleengine_networking_secgroup_v2 secgroup {
  name        = local.sg_name
  description = "terraform security group acceptance test"
}

resource flexibleengine_networking_secgroup_rule_v2 secgroup_rule_1 {
  direction         = "ingress"
  ethertype         = "IPv4"
  protocol          = "tcp"
  port_range_min    = 9200
  port_range_max    = 9200
  remote_ip_prefix  = var.vpc_cidr
  security_group_id = flexibleengine_networking_secgroup_v2.secgroup.id
}

resource flexibleengine_networking_secgroup_rule_v2 secgroup_rule_2 {
  direction         = "ingress"
  ethertype         = "IPv4"
  protocol          = "tcp"
  port_range_min    = 5601
  port_range_max    = 5601
  remote_ip_prefix  = var.vpc_cidr
  security_group_id = flexibleengine_networking_secgroup_v2.secgroup.id
}

resource flexibleengine_css_cluster_v1 cluster {
  name           = var.service_name
  engine_version = var.engine_version
  node_number    = var.node_number

  node_config {
    availability_zone = var.node_az
    flavor            = var.node_flavor

    network_info {
      vpc_id            = var.vpc_id
      subnet_id         = data.flexibleengine_vpc_subnet_v1.subnet.id
      security_group_id = flexibleengine_networking_secgroup_v2.secgroup.id
    }
    volume {
      volume_type = var.node_volume_type
      size        = var.node_volume_size
    }
  }

  tags = {
    Name = var.service_name
  }
}

Expected Behavior

CSS service is created without issue

Actual Behavior

Terraform exited with 2 different error messages:

Error: Error enable snapshot function: Internal Server Error

or

Error: Error enable snapshot function: Expected HTTP response code [200] when accessing [POST https://css.eu-west-0.prod-cloud-ocb.orange-business.com/v1.0/80ba4a1aac8745eda535af39aa9ee2d1/clusters/53e10d7b-4c1c-4ec3-b201-da48a992b32d/index_snapshot/auto_setting], but got 504 instead
{"request_id":"99e111d57a670511751ec8f8b52799fc","error_code":"APIGW.0201","error_msg":"Service CSS timed out (30000 ms)"}

Steps to Reproduce

  1. create a tf file containing the ressource CSS without backup configuration
  2. terraform apply
niuzhenguo commented 4 years ago

@ShiChangkuo please have a look at this ^

ShiChangkuo commented 4 years ago

@jpichonBZH thanks for raising. The backup function was auto enabled since 1.14.0 version, but it requires the authority of OBS Bucket and IAM Agency. please see here.

Actually, it's no necessary to require the authority if we don't configure backup. I'll fix it soon.

jpichon-OCB commented 4 years ago

@ShiChangkuo , I know that. I'm in admin group of the tenant, and all access to use bucket and IAM.

ShiChangkuo commented 4 years ago

maybe you can check your permissions from the document

jpichon-OCB commented 4 years ago

We check permissions, all are OK, but the plan still exits with error

Error: Error enable snapshot function: Expected HTTP response code [200] when accessing [POST https://css.eu-west-0.prod-cloud-ocb.orange-business.com/v1.0/80ba4a1aac8745eda535af39aa9ee2d1/clusters/bb0505de-22e8-4eca-9505-3f9d6e311adc/index_snapshot/auto_setting], but got 504 instead
{"request_id":"7bc7fb115e7a4e7d39dfeb86d4b56069","error_code":"APIGW.0201","error_msg":"Service CSS timed out (30000 ms)"}

The cluster is created, but I can't manage it, because the tstate doesn't contain CSS details.

niuzhenguo commented 4 years ago

@jpichonBZH There should be some issue with the CSS service on API side. We can disable this auto_setting API call as a workaround if you don't need backup_strategy now.

niuzhenguo commented 4 years ago

please try to build the provider with #396

jpichon-OCB commented 4 years ago

@niuzhenguo Hi, it's working with your modification. Thanks

qukuijin1989 commented 3 years ago

hi @jpichon-OCB , if this problem is resolved could you please closed it ?