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

improving control flow for lb_v2 resources #4

Closed
jrperritt opened this issue Jun 13, 2017 · 5 comments
Closed

improving control flow for lb_v2 resources #4

jrperritt opened this issue Jun 13, 2017 · 5 comments

Comments

@jrperritt
Copy link
Contributor

The control flow of waiting for LB v2 resources to become ready to create/update could be improved. Currently, for example, it just immediately retries if it gets a 409, which can lead to what appear to be race conditions in OpenStack. It seems like the problem should be fixed in OpenStack, but Terraform should handle this better by, for example, waiting until the LB is ACTIVE before continuing to try to create the LB pool after receiving a 409.

Terraform Version

0.9.8.

Affected Resource(s)

  • openstack_lb_*_v2

Terraform Configuration Files

You'll need to provide image_id and flavor_id:

variable "subnet_id" {
  type = "string"
  default = "4409be68-f1d6-44a5-a54a-bc22e790b237"
}

variable "image_id" {
  type = "string"
}

variable "flavor_id" {
  type = "string"
}

resource "openstack_lb_loadbalancer_v2" "lb" {
  vip_subnet_id = "${var.subnet_id}"
  name = "lb"
}

resource "openstack_lb_listener_v2" "lb_listener" {
  loadbalancer_id = "${openstack_lb_loadbalancer_v2.lb.id}"
  protocol = "HTTPS"
  protocol_port = 443
}

resource "openstack_lb_pool_v2" "lb_pool" {
  lb_method = "ROUND_ROBIN"
  protocol = "HTTPS"
  listener_id = "${openstack_lb_listener_v2.lb_listener.id}"
}

resource "openstack_lb_member_v2" "lb_member" {
  address = "${openstack_compute_instance_v2.server.access_ip_v4}"
  pool_id = "${openstack_lb_pool_v2.lb_pool.id}"
  protocol_port = 443
  subnet_id = "${var.subnet_id}"
}

resource "openstack_lb_monitor_v2" "lb_monitor" {
  delay = 30
  max_retries = 3
  pool_id = "${openstack_lb_pool_v2.lb_pool.id}"
  timeout = 5
  type = "PING"
}

resource "openstack_compute_instance_v2" "server" {
  name      = "server"
  image_id  = "${var.image_id}"
  flavor_id = "${var.flavor_id}"
  config_drive = false
}

Expected Behavior

1 LB pool gets created

Actual Behavior

4 LB pools get created

Steps to Reproduce

  1. terraform apply
@jtopjian
Copy link
Contributor

@jrperritt Is this similar to hashicorp/terraform#15225 or is a 409 being hit elsewhere?

I should probably just blanket all LB resources with 409 checks.

@jrperritt
Copy link
Contributor Author

Yes, similar to that, but the fix that was implemented is not sufficient. Instead of immediately retrying the request, waitForLoadBalancerActive (or similar) should be called to wait for an ACTIVE state.

@jrperritt
Copy link
Contributor Author

I'll submit a fix for this.

@jtopjian
Copy link
Contributor

jtopjian commented Jun 15, 2017

#25 has been merged. I'm sorry for the delay on that one.

@jtopjian
Copy link
Contributor

Fixed by #29

xgerman pushed a commit to xgerman/terraform-provider-openstack that referenced this issue Aug 3, 2017
# This is the 1st commit message:
Images v2: Fixing acceptance tests for image data source

# This is the commit message terraform-provider-openstack#2:

Object Storage v1: Disabling container tests until test environment can be fixed

# This is the commit message terraform-provider-openstack#3:

Firewall v1: Making associated_routers computed

# This is the commit message terraform-provider-openstack#4:

Firewall v1: Pass all attributes when a rule update occurs

# This is the commit message terraform-provider-openstack#5:

Network v2: Make network segment acceptance test an admin-only test
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

2 participants