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 for ec_deployment and ec_deployment_traffic_filter_association #656

Closed
4 tasks done
grumpymatt opened this issue May 23, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@grumpymatt
Copy link

Readiness Checklist

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I am reporting the issue to the correct repository (for multi-repository projects)

Expected Behavior

Terraform apply should return success.

Current Behavior

Error after applying. Resources get created but result is an error.

| Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to ec_deployment.tms_elasticsearch[0], provider
│ "provider[\"registry.terraform.io/elastic/ec\"]" produced an unexpected new
│ value: .traffic_filter: was null, but now
│ cty.SetVal([]cty.Value{cty.StringVal("b0f348b752c94452bcd4472e70fd2b1b")}).
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

## Terraform definition

data "ec_stack" "latest" {
  version_regex = "latest"
  region        = var.region
}

resource "ec_deployment" "deploy_elasticsearch" {
  count = var.qualifier == "qa" ? 0 : 1
  name = "deploy_${var.level_env}"

  region                 = var.region
  version                = data.ec_stack.latest.version
  deployment_template_id = "aws-general-purpose-arm-v6"

  elasticsearch = {
    hot = {
      autoscaling = {
      }
     size = "2g"
    }
  }

  kibana = {}

  enterprise_search = {}

  integrations_server = {}
}

data "ec_traffic_filter" "vpce_tf" {
  name = "${var.qualified_prefix}-elasticsearch-tf"
}

resource "ec_deployment_traffic_filter_association" "elasticsearch_traffic_filter_association" {
  count = var.qualifier == "qa" ? 0 : 1
  traffic_filter_id = data.ec_traffic_filter.vpce_tf.rulesets[0].id
  deployment_id     = ec_deployment.deploy_elasticsearch[0].id
}

Steps to Reproduce

  1. terraform apply

Context

Possible Solution

Your Environment

  • Version used:
    Terraform v1.4.6
    on linux_amd64
    provider registry.terraform.io/elastic/ec v0.7.0
    provider registry.terraform.io/hashicorp/aws v4.62.0
    provider registry.terraform.io/hashicorp/external v2.3.1
  • Running against Elastic Cloud SaaS or Elastic Cloud Enterprise and version: Elastic Cloud
  • Environment name and version (e.g. Go 1.9):
  • Server type and version:
  • Operating System and version: Linux
  • Link to your project:
@grumpymatt grumpymatt added the bug Something isn't working label May 23, 2023
@tommed
Copy link

tommed commented May 25, 2023

I'm getting this too. :-/
Happy to provide some details if that will help.
Obviously it's causing us some issues with production environments.

image

Log available here:
https://gist.github.com/tommed/4769e428519c3b8410f6ee77c00fb57b

@renzedj
Copy link

renzedj commented May 30, 2023

Same error, but I'm not even attempting to create a traffic filter.

@grumpymatt
Copy link
Author

I found a potential workaround. Ignoring changes to the traffic_filter attribute on the ec_deployment allowed me to apply without errors.

Here is the resource with the ignore block at the bottom:

resource "ec_deployment" "tms_elasticsearch" {
  count = var.qualifier == "qa" ? 0 : 1
  # Optional name.
  name = "ec_deploymentName"

  region                 = var.region
  version                = data.ec_stack.latest.version
  deployment_template_id = "aws-general-purpose-arm-v6"

  elasticsearch = {
    hot = {
      autoscaling = {
      }
     size = "2g"
    }
  }

  kibana = {}

  enterprise_search = {}

  integrations_server = {}

  lifecycle {
    ignore_changes = [
      traffic_filter
    ]
  }
}

@renzedj
Copy link

renzedj commented May 30, 2023

I found a potential workaround. Ignoring changes to the traffic_filter attribute on the ec_deployment allowed me to apply without errors.

This did not work in my situation, possibly because I'm not defining my traffic filters in terraform yet.

@tommed
Copy link

tommed commented May 31, 2023

Didn't work for me either:

When applying changes to ec_deployment.elastic_cloud_db_deployment[0], provider "provider["registry.terraform.io/elastic/ec"]" produced an unexpected new value: .traffic_filter: length changed from 1 to 2. This is a bug in the provider, which should be reported in the provider's own issue tracker.

Regarding...

Ignoring changes to the traffic_filter attribute on the ec_deployment allowed me to apply without errors.

This isn't a good workaround for us as we want to track and apply the traffic filters.

Is there anyone from the provider developer community active on these boards? Or is plugin unsupported?

@grumpymatt
Copy link
Author

Just so it's clear, I am still applying a traffic filter with my workaround. I am using the separate ec_deployment_traffic_filter_association resource to apply the traffic_filter and not the attribute on the ec_deployment.

@tommed
Copy link

tommed commented May 31, 2023

Ah ok, thanks for the clarification - this is all quite new to me.
I did try it however, the workaround still results in the same message for me.

@tobio
Copy link
Member

tobio commented May 31, 2023

This appears to be a duplicate of #621. There's a fix for this in the main branch, which will be included in the next release. There's no timeframe on that at the moment, IIUC we're waiting on some ESS API changes in order to fix #433.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants