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: bugs 535 and 539 only find storage for application being read #557

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

hmlanigan
Copy link
Member

@hmlanigan hmlanigan commented Aug 27, 2024

Description

FullStatus was called without a filter. The storage returned in the structure was assumed to be for the application being read. In reality it was for all application's in the model. Unfortunately piecing which storage is for which application is non-trivial as the data is embedded deep in the structure on a unit level.

Instead call FullStatus with a filter of the application name when Reading, this ensures that the returned storage is for the current application only.

Updated an application acceptance test to ensure storage isn't written for applications without storage.

Fixes: #535, #539, #550

Type of change

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

QA steps

terraform {
  required_providers {
    juju = {
      version = ">0.12.0"
      source  = "juju/juju"
    }
  }
}

provider "juju" {
}

resource "juju_model" "one" {
  name = "testing"
}

resource "juju_application" "test" {
   model = juju_model.one.name
   charm {
     name = "juju-qa-test"
   }
}

resource "juju_application" "githubrunner" {
  name  = "github-runner"
  model = juju_model.one.name

  charm {
    name     = "github-runner"
    channel  = "latest/stable"
    base = "[email protected]"
  }
  units = 1

  storage_directives = {
    runner = "2G"
  }
}
# output from the below should include storage_directive and storage
$ terraform state show juju_application.githubrunner

# output from below should not include any mention of storage
$ terraform state show juju_application.test

Additional notes

JUJU-6599

Copy link
Contributor

@Aflynn50 Aflynn50 left a comment

Choose a reason for hiding this comment

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

Excellent! I tried out the reproducer from bug #550 and it seems that issue is fixed too!
Just left a comment about the comment above the line changed.

internal/juju/applications.go Outdated Show resolved Hide resolved
Call full status with a filter of the application name when Reading,
this ensures that the returned storage is for the current application
only.

Updated an application acceptance test to ensure storage isn't written
for applications without storage.
@hmlanigan hmlanigan force-pushed the storage-per-application branch from 6695aa2 to 4d59f2d Compare August 28, 2024 18:09
@hmlanigan hmlanigan added this to the 0.14.0 milestone Aug 28, 2024
@hmlanigan
Copy link
Member Author

/merge

@jujubot jujubot merged commit 9f9fc02 into juju:main Aug 29, 2024
25 of 29 checks passed
@hmlanigan hmlanigan deleted the storage-per-application branch August 29, 2024 13:19
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

Successfully merging this pull request may close these issues.

Terraform 0.13.0 takes 15 times longer time to run apply than 0.12.0
3 participants