Skip to content

[Bug] elasticstack_fleet_integration_policy fails with inconsistent result after apply #4329

Description

@wasfree

Bug: elasticstack_fleet_integration_policy fails with Provider produced inconsistent result after apply for sensitive inputs

Summary

Applying an elasticstack_fleet_integration_policy for azure_blob_storage fails with:

  • Provider produced inconsistent result after apply
  • .inputs: inconsistent values for sensitive attribute

This appears to be a provider-side state/semantic equality issue for sensitive inputs values.

Environment

  • Terraform CLI: (run locally, likely 1.8+ in this workspace)
  • Provider: registry.terraform.io/elastic/elasticstack 0.16.3
  • OS: macOS (darwin arm64)

From terraform providers:

  • module.main -> provider[registry.terraform.io/elastic/elasticstack] 0.16.3

Failing resource address

module.main.module.fleet_integrations["azure_blob_storage"].elasticstack_fleet_integration_policy.policy["azure_blob_storage_policy"]

Error output

Error: Provider produced inconsistent result after apply

When applying changes to
module.main.module.fleet_integrations["azure_blob_storage"].elasticstack_fleet_integration_policy.policy["azure_blob_storage_policy"],
provider "module.main.provider[\"registry.terraform.io/elastic/elasticstack\"]"
produced an unexpected new value: .inputs: inconsistent values for sensitive
attribute.

Minimal repro config (extracted)

resource "elasticstack_fleet_integration_policy" "policy" {
  name                = "azure_blob_storage_policy_integration@azure_blob_storage"
  namespace           = "example.nonprod"
  description         = "Azure Blob Storage integration policy for validation testing"
  integration_name    = "azure_blob_storage"
  integration_version = "2.3.0"
  agent_policy_ids    = ["<existing-agent-policy-id>"]

  inputs = {
    "azure-blob-storage-azure-blob-storage" = {
      enabled = true
      streams = {
        "azure_blob_storage.azure-blob-storage" = {
          enabled = true
          vars = {
            oauth2                  = false
            account_name            = "stpltopsvalone"
            service_account_key     = "<sensitive>"
            "data_stream.dataset"   = "azure_blob_storage.validation"
            number_of_workers       = 3
            poll                    = true
            poll_interval           = "15s"
            containers              = "- name: test\n"
            file_selectors          = "# - regex: \"event/\"\n"
            preserve_original_event = false
            tags = ["forwarded", "azure_blob_storage-validation"]
          }
        }
      }
    }
  }
}

Reproduction steps

  1. Define elasticstack_fleet_integration_policy with inputs like above (including sensitive service_account_key in stream vars).
  2. Run apply (targeted or full):
    • terraform apply -auto-approve -target='module.main.module.fleet_integrations["azure_blob_storage"].elasticstack_fleet_integration_policy.policy["azure_blob_storage_policy"]'
  3. Resource create starts, then provider returns inconsistent result error on .inputs.

Observed behavior

  • Provider fails post-apply reconciliation with .inputs: inconsistent values for sensitive attribute.
  • Terraform cannot expose value-level old/new for sensitive attributes, only path-level mismatch.

Expected behavior

  • Provider should either:
    • return state exactly matching planned inputs, or
    • perform semantic equality that safely handles sensitive maps without reporting inconsistency.

Trace evidence (TF_LOG=TRACE)

From /tmp/tf-elasticstack-trace.log:

  • Provider validates and manipulates nested input path:
    • inputs["azure-blob-storage-azure-blob-storage"].streams["azure_blob_storage.azure-blob-storage"].vars
  • Provider applies defaults on nested key:
    • setting attribute inputs["azure-blob-storage-azure-blob-storage"].defaults to default value: <null>
  • Plan modifier invoked on inputs:
    • Calling provider defined planmodifier.Map ... description="Once set, the value of this attribute in state will not change."
  • Apply ultimately fails with inconsistent sensitive attribute for .inputs.

Additional notes

  • Earlier payload issues were resolved (service_account_key missing, wrong input key name). Current failure remains after valid input shape and key.
  • This appears specific to elasticstack_fleet_integration_policy path with sensitive inputs.

Workaround currently used

Manage azure_blob_storage via the older agent_policies.integrations path instead of fleet_integrations until provider fix is available.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-reproductionQueued for reproducer-factory: needs reproduction casephase-specificationIssue is in the specification phase of the factory pipelinetriagedIssue has been classified and routed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions