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

provider produced inconsistent result after apply on constraints #344

Open
gboutry opened this issue Nov 23, 2023 · 3 comments
Open

provider produced inconsistent result after apply on constraints #344

gboutry opened this issue Nov 23, 2023 · 3 comments
Labels
hint/main going on main branch kind/bug indicates a bug in the project

Comments

@gboutry
Copy link
Contributor

gboutry commented Nov 23, 2023

Description

Applying a plan with constraints fails

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to juju_application.mysql, provider "provider[\"registry.terraform.io/juju/juju\"]" produced an unexpected new value: .constraints: was cty.StringVal("mem=2048"), but now cty.StringVal("arch=amd64 mem=2048M").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Urgency

Casually reporting

Terraform Juju Provider version

0.10.0

Terraform version

v1.6.4

Terraform Configuration(s)

resource "juju_application" "mysql" {
  name        = "mysql"
  trust       = true
  model       = "cert"
  constraints = "mem=2048"

  charm {
    name    = "mysql-k8s"
    channel = "8.0/stable"
  }
}

Reproduce / Test

- terraform init
- terraform apply

Debug/Panic Output

2023-11-23T17:56:47.408+0100 [INFO]  Terraform version: 1.6.4
2023-11-23T17:56:47.409+0100 [DEBUG] using github.com/hashicorp/go-tfe v1.36.0
2023-11-23T17:56:47.409+0100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.19.1
2023-11-23T17:56:47.409+0100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2023-11-23T17:56:47.409+0100 [DEBUG] using github.com/zclconf/go-cty v1.14.1
2023-11-23T17:56:47.409+0100 [INFO]  Go runtime version: go1.21.3
2023-11-23T17:56:47.409+0100 [INFO]  CLI args: []string{"terraform", "apply"}
2023-11-23T17:56:47.409+0100 [DEBUG] Attempting to open CLI config file: /home/gboutry/.terraformrc
2023-11-23T17:56:47.409+0100 [INFO]  Loading CLI configuration from /home/gboutry/.terraformrc
2023-11-23T17:56:47.409+0100 [DEBUG] checking for credentials in "/home/gboutry/.terraform.d/plugins"
2023-11-23T17:56:47.409+0100 [DEBUG] Explicit provider installation configuration is set
2023-11-23T17:56:47.409+0100 [INFO]  CLI command args: []string{"apply"}
2023-11-23T17:56:47.409+0100 [DEBUG] New state was assigned lineage "93616b5a-77c3-8423-17b4-e6badc61197f"
2023-11-23T17:56:47.442+0100 [DEBUG] checking for provisioner in "."
2023-11-23T17:56:47.448+0100 [DEBUG] checking for provisioner in "/usr/bin"
2023-11-23T17:56:47.448+0100 [DEBUG] checking for provisioner in "/home/gboutry/.terraform.d/plugins"
2023-11-23T17:56:47.448+0100 [INFO]  backend/local: starting Apply operation
2023-11-23T17:56:47.449+0100 [DEBUG] created provider logger: level=debug
2023-11-23T17:56:47.449+0100 [INFO]  provider: configuring client automatic mTLS
2023-11-23T17:56:47.457+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 args=[".terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0"]
2023-11-23T17:56:47.457+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569559
2023-11-23T17:56:47.457+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0
2023-11-23T17:56:47.472+0100 [INFO]  provider.terraform-provider-juju_v0.10.0: configuring server automatic mTLS: timestamp="2023-11-23T17:56:47.472+0100"
2023-11-23T17:56:47.481+0100 [DEBUG] provider: using plugin: version=6
2023-11-23T17:56:47.481+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: plugin address: address=/tmp/plugin2286039014 network=unix timestamp="2023-11-23T17:56:47.481+0100"
2023-11-23T17:56:47.490+0100 [DEBUG] No provider meta schema returned
2023-11-23T17:56:47.490+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-11-23T17:56:47.493+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569559
2023-11-23T17:56:47.493+0100 [DEBUG] provider: plugin exited
2023-11-23T17:56:47.493+0100 [DEBUG] Building and walking validate graph
2023-11-23T17:56:47.493+0100 [DEBUG] ProviderTransformer: "juju_application.mysql" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/juju/juju"]
2023-11-23T17:56:47.493+0100 [DEBUG] ReferenceTransformer: "juju_application.mysql" references: []
2023-11-23T17:56:47.493+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/juju/juju\"]" references: []
2023-11-23T17:56:47.493+0100 [DEBUG] Starting graph walk: walkValidate
2023-11-23T17:56:47.493+0100 [DEBUG] created provider logger: level=debug
2023-11-23T17:56:47.493+0100 [INFO]  provider: configuring client automatic mTLS
2023-11-23T17:56:47.495+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 args=[".terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0"]
2023-11-23T17:56:47.496+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569571
2023-11-23T17:56:47.496+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0
2023-11-23T17:56:47.511+0100 [INFO]  provider.terraform-provider-juju_v0.10.0: configuring server automatic mTLS: timestamp="2023-11-23T17:56:47.511+0100"
2023-11-23T17:56:47.522+0100 [DEBUG] provider: using plugin: version=6
2023-11-23T17:56:47.522+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: plugin address: address=/tmp/plugin4129207949 network=unix timestamp="2023-11-23T17:56:47.522+0100"
2023-11-23T17:56:47.531+0100 [DEBUG] No provider meta schema returned
2023-11-23T17:56:47.533+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-11-23T17:56:47.535+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569571
2023-11-23T17:56:47.535+0100 [DEBUG] provider: plugin exited
2023-11-23T17:56:47.535+0100 [INFO]  backend/local: apply calling Plan
2023-11-23T17:56:47.535+0100 [DEBUG] Building and walking plan graph for NormalMode
2023-11-23T17:56:47.535+0100 [DEBUG] ProviderTransformer: "juju_application.mysql (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/juju/juju"]
2023-11-23T17:56:47.535+0100 [DEBUG] ReferenceTransformer: "juju_application.mysql (expand)" references: []
2023-11-23T17:56:47.535+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/juju/juju\"]" references: []
2023-11-23T17:56:47.535+0100 [DEBUG] Starting graph walk: walkPlan
2023-11-23T17:56:47.535+0100 [DEBUG] created provider logger: level=debug
2023-11-23T17:56:47.535+0100 [INFO]  provider: configuring client automatic mTLS
2023-11-23T17:56:47.539+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 args=[".terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0"]
2023-11-23T17:56:47.539+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569590
2023-11-23T17:56:47.539+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0
2023-11-23T17:56:47.554+0100 [INFO]  provider.terraform-provider-juju_v0.10.0: configuring server automatic mTLS: timestamp="2023-11-23T17:56:47.554+0100"
2023-11-23T17:56:47.568+0100 [DEBUG] provider: using plugin: version=6
2023-11-23T17:56:47.568+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: plugin address: network=unix address=/tmp/plugin3357800449 timestamp="2023-11-23T17:56:47.568+0100"
2023-11-23T17:56:47.576+0100 [DEBUG] No provider meta schema returned
2023-11-23T17:56:47.755+0100 [DEBUG] Resource instance state not found for node "juju_application.mysql", instance juju_application.mysql
2023-11-23T17:56:47.755+0100 [DEBUG] ReferenceTransformer: "juju_application.mysql" references: []
2023-11-23T17:56:47.755+0100 [DEBUG] refresh: juju_application.mysql: no state, so not refreshing
2023-11-23T17:56:47.757+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Marking Computed attributes with null configuration values as unknown (known after apply) in the plan to prevent potential Terraform errors: @module=sdk.framework tf_req_id=e033dd25-bf71-dc77-cac3-fa9823fd895b tf_resource_type=juju_application tf_rpc=PlanResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:195 tf_provider_addr=registry.terraform.io/juju/juju timestamp="2023-11-23T17:56:47.757+0100"
2023-11-23T17:56:47.757+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 tf_rpc=PlanResourceChange @module=sdk.framework tf_attribute_path="AttributeName(\"charm\").ElementKeyInt(0).AttributeName(\"base\")" tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=e033dd25-bf71-dc77-cac3-fa9823fd895b tf_resource_type=juju_application timestamp="2023-11-23T17:56:47.757+0100"
2023-11-23T17:56:47.757+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 tf_attribute_path="AttributeName(\"charm\").ElementKeyInt(0).AttributeName(\"revision\")" tf_provider_addr=registry.terraform.io/juju/juju tf_rpc=PlanResourceChange @module=sdk.framework tf_req_id=e033dd25-bf71-dc77-cac3-fa9823fd895b tf_resource_type=juju_application timestamp="2023-11-23T17:56:47.757+0100"
2023-11-23T17:56:47.757+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_resource_type=juju_application @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework tf_attribute_path="AttributeName(\"charm\").ElementKeyInt(0).AttributeName(\"series\")" tf_req_id=e033dd25-bf71-dc77-cac3-fa9823fd895b tf_provider_addr=registry.terraform.io/juju/juju tf_rpc=PlanResourceChange timestamp="2023-11-23T17:56:47.757+0100"
2023-11-23T17:56:47.757+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=e033dd25-bf71-dc77-cac3-fa9823fd895b tf_rpc=PlanResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework tf_attribute_path="AttributeName(\"principal\")" tf_resource_type=juju_application timestamp="2023-11-23T17:56:47.757+0100"
2023-11-23T17:56:47.757+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_rpc=PlanResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework tf_resource_type=juju_application tf_attribute_path="AttributeName(\"placement\")" tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=e033dd25-bf71-dc77-cac3-fa9823fd895b timestamp="2023-11-23T17:56:47.757+0100"
2023-11-23T17:56:47.757+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_req_id=e033dd25-bf71-dc77-cac3-fa9823fd895b tf_resource_type=juju_application tf_rpc=PlanResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework tf_attribute_path="AttributeName(\"id\")" tf_provider_addr=registry.terraform.io/juju/juju timestamp="2023-11-23T17:56:47.757+0100"
2023-11-23T17:56:47.760+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-11-23T17:56:47.762+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569590
2023-11-23T17:56:47.762+0100 [DEBUG] provider: plugin exited
2023-11-23T17:56:47.762+0100 [DEBUG] building apply graph to check for errors
2023-11-23T17:56:47.762+0100 [DEBUG] Resource state not found for node "juju_application.mysql", instance juju_application.mysql
2023-11-23T17:56:47.762+0100 [DEBUG] ProviderTransformer: "juju_application.mysql (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/juju/juju"]
2023-11-23T17:56:47.762+0100 [DEBUG] ProviderTransformer: "juju_application.mysql" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/juju/juju"]
2023-11-23T17:56:47.762+0100 [DEBUG] ReferenceTransformer: "juju_application.mysql (expand)" references: []
2023-11-23T17:56:47.762+0100 [DEBUG] ReferenceTransformer: "juju_application.mysql" references: []
2023-11-23T17:56:47.762+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/juju/juju\"]" references: []

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # juju_application.mysql will be created
  + resource "juju_application" "mysql" {
      + constraints = "mem=2048"
      + id          = (known after apply)
      + model       = "cert"
      + name        = "mysql"
      + placement   = (known after apply)
      + principal   = (known after apply)
      + trust       = true
      + units       = 1

      + charm {
          + base     = (known after apply)
          + channel  = "8.0/stable"
          + name     = "mysql-k8s"
          + revision = (known after apply)
          + series   = (known after apply)
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.
2023-11-23T17:56:47.763+0100 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

2023-11-23T17:56:48.746+0100 [INFO]  backend/local: apply calling Apply
2023-11-23T17:56:48.746+0100 [DEBUG] Building and walking apply graph for NormalMode plan
2023-11-23T17:56:48.746+0100 [DEBUG] Resource state not found for node "juju_application.mysql", instance juju_application.mysql
2023-11-23T17:56:48.746+0100 [DEBUG] ProviderTransformer: "juju_application.mysql (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/juju/juju"]
2023-11-23T17:56:48.746+0100 [DEBUG] ProviderTransformer: "juju_application.mysql" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/juju/juju"]
2023-11-23T17:56:48.746+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/juju/juju\"]" references: []
2023-11-23T17:56:48.746+0100 [DEBUG] ReferenceTransformer: "juju_application.mysql (expand)" references: []
2023-11-23T17:56:48.746+0100 [DEBUG] ReferenceTransformer: "juju_application.mysql" references: []
2023-11-23T17:56:48.747+0100 [DEBUG] Starting graph walk: walkApply
2023-11-23T17:56:48.747+0100 [DEBUG] created provider logger: level=debug
2023-11-23T17:56:48.747+0100 [INFO]  provider: configuring client automatic mTLS
2023-11-23T17:56:48.753+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 args=[".terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0"]
2023-11-23T17:56:48.754+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569679
2023-11-23T17:56:48.754+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0
2023-11-23T17:56:48.772+0100 [INFO]  provider.terraform-provider-juju_v0.10.0: configuring server automatic mTLS: timestamp="2023-11-23T17:56:48.772+0100"
2023-11-23T17:56:48.788+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: plugin address: address=/tmp/plugin3467904315 network=unix timestamp="2023-11-23T17:56:48.788+0100"
2023-11-23T17:56:48.788+0100 [DEBUG] provider: using plugin: version=6
2023-11-23T17:56:48.796+0100 [DEBUG] No provider meta schema returned
2023-11-23T17:56:48.976+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Marking Computed attributes with null configuration values as unknown (known after apply) in the plan to prevent potential Terraform errors: tf_rpc=PlanResourceChange @module=sdk.framework tf_resource_type=juju_application tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=bd2a823b-1458-be7d-e288-5e33f28d1217 @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:195 timestamp="2023-11-23T17:56:48.976+0100"
2023-11-23T17:56:48.976+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=bd2a823b-1458-be7d-e288-5e33f28d1217 tf_resource_type=juju_application tf_rpc=PlanResourceChange @module=sdk.framework tf_attribute_path="AttributeName(\"id\")" @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 timestamp="2023-11-23T17:56:48.976+0100"
2023-11-23T17:56:48.976+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_req_id=bd2a823b-1458-be7d-e288-5e33f28d1217 tf_attribute_path="AttributeName(\"charm\").ElementKeyInt(0).AttributeName(\"series\")" tf_provider_addr=registry.terraform.io/juju/juju tf_resource_type=juju_application tf_rpc=PlanResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework timestamp="2023-11-23T17:56:48.976+0100"
2023-11-23T17:56:48.976+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_rpc=PlanResourceChange tf_resource_type=juju_application tf_attribute_path="AttributeName(\"charm\").ElementKeyInt(0).AttributeName(\"base\")" tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=bd2a823b-1458-be7d-e288-5e33f28d1217 @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework timestamp="2023-11-23T17:56:48.976+0100"
2023-11-23T17:56:48.976+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_resource_type=juju_application tf_rpc=PlanResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework tf_attribute_path="AttributeName(\"charm\").ElementKeyInt(0).AttributeName(\"revision\")" tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=bd2a823b-1458-be7d-e288-5e33f28d1217 timestamp="2023-11-23T17:56:48.976+0100"
2023-11-23T17:56:48.976+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_attribute_path="AttributeName(\"principal\")" tf_provider_addr=registry.terraform.io/juju/juju tf_resource_type=juju_application @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework tf_req_id=bd2a823b-1458-be7d-e288-5e33f28d1217 tf_rpc=PlanResourceChange timestamp="2023-11-23T17:56:48.976+0100"
2023-11-23T17:56:48.976+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: marking computed attribute that is null in the config as unknown: tf_attribute_path="AttributeName(\"placement\")" tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=bd2a823b-1458-be7d-e288-5e33f28d1217 tf_resource_type=juju_application tf_rpc=PlanResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_planresourcechange.go:399 @module=sdk.framework timestamp="2023-11-23T17:56:48.976+0100"
juju_application.mysql: Creating...
2023-11-23T17:56:48.977+0100 [INFO]  Starting apply for juju_application.mysql
2023-11-23T17:56:48.978+0100 [DEBUG] juju_application.mysql: applying the planned Create change
2023-11-23T17:56:49.749+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Value switched to prior value due to semantic equality logic: @module=sdk.framework tf_req_id=44406122-59ed-eef3-9c38-c96eb7a31e39 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwschemadata/value_semantic_equality.go:85 tf_attribute_path=units tf_provider_addr=registry.terraform.io/juju/juju tf_resource_type=juju_application timestamp="2023-11-23T17:56:49.749+0100"
2023-11-23T17:56:49.749+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Value switched to prior value due to semantic equality logic: tf_attribute_path=name tf_req_id=44406122-59ed-eef3-9c38-c96eb7a31e39 tf_resource_type=juju_application @caller=github.com/hashicorp/[email protected]/internal/fwschemadata/value_semantic_equality.go:85 @module=sdk.framework tf_provider_addr=registry.terraform.io/juju/juju tf_rpc=ApplyResourceChange timestamp="2023-11-23T17:56:49.749+0100"
2023-11-23T17:56:49.750+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Value switched to prior value due to semantic equality logic: @module=sdk.framework tf_attribute_path=model tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=44406122-59ed-eef3-9c38-c96eb7a31e39 tf_resource_type=juju_application tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwschemadata/value_semantic_equality.go:85 timestamp="2023-11-23T17:56:49.750+0100"
2023-11-23T17:56:49.750+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Value switched to prior value due to semantic equality logic: tf_req_id=44406122-59ed-eef3-9c38-c96eb7a31e39 tf_rpc=ApplyResourceChange @module=sdk.framework tf_attribute_path=trust @caller=github.com/hashicorp/[email protected]/internal/fwschemadata/value_semantic_equality.go:85 tf_provider_addr=registry.terraform.io/juju/juju tf_resource_type=juju_application timestamp="2023-11-23T17:56:49.750+0100"
2023-11-23T17:56:49.750+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Value switched to prior value due to semantic equality logic: tf_provider_addr=registry.terraform.io/juju/juju tf_req_id=44406122-59ed-eef3-9c38-c96eb7a31e39 tf_resource_type=juju_application tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwschemadata/value_semantic_equality.go:85 tf_attribute_path=charm[0].channel @module=sdk.framework timestamp="2023-11-23T17:56:49.750+0100"
2023-11-23T17:56:49.750+0100 [DEBUG] provider.terraform-provider-juju_v0.10.0: Value switched to prior value due to semantic equality logic: @caller=github.com/hashicorp/[email protected]/internal/fwschemadata/value_semantic_equality.go:85 @module=sdk.framework tf_provider_addr=registry.terraform.io/juju/juju tf_rpc=ApplyResourceChange tf_attribute_path=charm[0].name tf_req_id=44406122-59ed-eef3-9c38-c96eb7a31e39 tf_resource_type=juju_application timestamp="2023-11-23T17:56:49.750+0100"
2023-11-23T17:56:49.752+0100 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2023-11-23T17:56:49.752+0100 [ERROR] vertex "juju_application.mysql" error: Provider produced inconsistent result after apply
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to juju_application.mysql, provider "provider[\"registry.terraform.io/juju/juju\"]" produced an unexpected new value: .constraints: was cty.StringVal("mem=2048"), but now cty.StringVal("arch=amd64 mem=2048M").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

2023-11-23T17:56:49.754+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-11-23T17:56:49.757+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/juju/juju/0.10.0/linux_amd64/terraform-provider-juju_v0.10.0 pid=569679
2023-11-23T17:56:49.757+0100 [DEBUG] provider: plugin exited

Notes & References

No response

@gboutry gboutry added the kind/bug indicates a bug in the project label Nov 23, 2023
@cderici cderici added the hint/main going on main branch label Nov 29, 2023
@hmlanigan
Copy link
Member

This is caused by the juju server adding an architecture constraint if one was not provided by the user. However during read, the provider has no knowledge of whether the user intended this or not, nor the ability to get the user's data.

To fix this will require a break schema change. One is in planning.

@hmlanigan
Copy link
Member

From #536:

Another thing is adding 16G won't work, as on the next apply terraform complains that plan says 16G, but but state says 16384M. Those values are the same, so we shouldn't get an error about it.

@hloeung
Copy link

hloeung commented Nov 18, 2024

Seeing this with v0.15.0 as well, Terraform apply fails:

module.postgresql-database.juju_application.backups_s3_integrator[0]: Creation complete after 15m5s [id=stg-is-dbaas-testing:backups-s3-integrator]
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to module.postgresql-database.juju_application.postgresql, provider "provider[\"registry.terraform.io/juju/juju\"]" produced an
│ unexpected new value: .constraints: was cty.StringVal("arch=amd64 cores=2 mem=4096M root-disk=20G"), but now cty.StringVal("arch=amd64 cores=2 mem=4096M
│ root-disk=20480M").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Then next run causes destruction because of the constraint differences:

  # module.postgresql-database.juju_application.postgresql is tainted, so must be replaced
-/+ resource "juju_application" "postgresql" {
      ~ constraints = "arch=amd64 cores=2 mem=4096M root-disk=20480M" -> "arch=amd64 cores=2 mem=4096M root-disk=20G"
      ~ id          = "stg-is-dbaas-testing:postgresql" -> (known after apply)
        name        = "postgresql"
      ~ placement   = "2,3,4" -> (known after apply)
      + principal   = (known after apply)
      ~ storage     = [
          - {
              - count = 1 -> null
              - label = "pgdata" -> null
              - pool  = "rootfs" -> null
              - size  = "20G" -> null
            },
          - {
              - count = 1 -> null
              - label = "pgdata-1" -> null
              - pool  = "rootfs" -> null
              - size  = "20G" -> null
            },
          - {
              - count = 1 -> null
              - label = "pgdata-2" -> null
              - pool  = "rootfs" -> null
              - size  = "20G" -> null
            },
        ] -> (known after apply)
        # (3 unchanged attributes hidden)

      ~ charm {
            name     = "postgresql"
          ~ series   = "jammy" -> (known after apply)
            # (3 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hint/main going on main branch kind/bug indicates a bug in the project
Projects
None yet
Development

No branches or pull requests

4 participants