Skip to content

[BUG] Blue-Green deployment fails while waiting for secondary application to unbind Instances #456

@nadezhda-y

Description

@nadezhda-y

Is there an existing issue for this?

  • I have searched the existing issues

What version of the Terraform provider are you using?

1.11.0

What version of the Terraform CLI are you using?

1.14.0

What CF API version are you using?

3.189.0

What type of issue are you facing

bug report

Describe the bug

When deploying an application using the cloudfoundry_app resource with strategy = "blue-green", the deployment fails during the transition phase between the two application instances.

The initial (blue) application is successfully running and serving traffic. A new (green) application instance is created as expected. However, during the switchover process, the deployment gets stuck while waiting for the old application to unbind or release its service instances.

Eventually, the process fails with an error similar to:
received state FAILED while waiting for async process:
│ cfclient error (CF-UnprocessableEntity|10008): An operation for the service binding between app application-venerable and service instance schema-app is in progress.

Could you please advise on how to handle this scenario?

In this case, extracting the service_bindings into separate resources is not a viable option, as the application depends on them at startup and would fail to initialize without the required bindings in place.

Expected Behavior

Terraform should wait until all asynchronous Cloud Foundry operations (especially service unbinding) are fully completed before proceeding.

Steps To Reproduce

No response

Your Terraform Configuration

resource "cloudfoundry_app" "application" {
  name                            = application
  space_name                      = var.space_name
  org_name                        = var.cf_org_name
  path                            = "application.jar"
  strategy                        = blue-green
  health_check_http_endpoint      = "/health/ping"
  health_check_type               = "http"
  health_check_invocation_timeout = 600
  timeout                         = 600
  instances                       = 2
  memory                          = 1024
  disk_quota                      = 1024
  service_bindings = concat([
    {
      service_instance = data.cloudfoundry_service_instance.schema.name
    },
    {
      service_instance = data.cloudfoundry_service_instance.db.name
    },
    ])

Roles

No response

Add screenshots to help explain your problem

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions