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

Fix panic in intergration resource update #334

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

cderici
Copy link

@cderici cderici commented Oct 30, 2023

Description

This is a quick run-by fix for something I bumped into when I was working on #235. Looks like the type of the applications in integration resource's Update is set to be an Attribute instead of a Block like in the Schema.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Environment

  • Juju controller version: 2.9

  • Terraform version: 1.5

QA steps

Any plan that updates an integration would hit that. I'll add the plan that I was using when I bumped into this one.

Apply the plan below, let it settle, then uncomment the wordpresstwo and change the app name in the integration.

resource "juju_model" "development" {
  name = "development"
}

resource "juju_application" "wordpress" {
  name = "wordpress"

  model = juju_model.development.name

  charm {
    name = "wordpress"
  }

  units = 3
}


/*
resource "juju_application" "wordpresstwo" {
  name = "wordpresstwo"

  model = juju_model.development.name

  charm {
    name = "wordpress"
  }

  units = 3
}
*/


resource "juju_application" "percona-cluster" {
  name = "percona-cluster"

  model = juju_model.development.name

  charm {
    name = "percona-cluster"
  }

  units = 3
}

resource "juju_integration" "wp_to_percona" {
  model = juju_model.development.name

  application {
    name     = juju_application.wordpress.name # <---------- change this to wordpresstwo
    endpoint = "db"
  }

  application {
    name     = juju_application.percona-cluster.name
    endpoint = "db"
  }
}

@cderici cderici added the kind/bug indicates a bug in the project label Oct 30, 2023
@cderici cderici requested a review from hmlanigan October 30, 2023 17:30
Copy link
Member

@hmlanigan hmlanigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the commit message to describe why and how this fixes the panic.

We need an AT which tests Update.

The 'application' field in the integration resource is not an
Attribute, but a Block, which is why when this part of the code is
hit, we get a panic with the interface conversion saying that this
doesn't look like an Attribute.
@cderici cderici force-pushed the integration-update-fix branch from 833a106 to 3894b47 Compare October 30, 2023 20:49
@cderici cderici merged commit 5057ec8 into juju:main Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug indicates a bug in the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants