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

launchdarkly_environment resource produces "Provider produced inconsistent Result after apply" #31

Open
wondersd opened this issue Jul 28, 2020 · 9 comments

Comments

@wondersd
Copy link

wondersd commented Jul 28, 2020

Every once in a while this comes up during creation of a new launchdarkly_environment resource.

Error: Provider produced inconsistent result after apply

When applying changes to
launchdarkly_environment.environment,
provider "registry.terraform.io/-/launchdarkly" produced an unexpected new
value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.
resource "launchdarkly_environment" "environment" {
  name = "name"
  key   = "key"
  color = "color"
  tags  = [ "tag" ]
  project_key = "default"
}
@ldhenry
Copy link
Collaborator

ldhenry commented Jul 29, 2020

Thanks @wondersd, this is not ideal. When you get a chance can you you share the output of terraform -v to help me reproduce this issue?

Thanks,
Henry

@wondersd
Copy link
Author

@ldhenry I cranked the logs on our process when we create the environment. This one doesn't happen as often as the other issue i opened (#30), when it happens again I'll post the logs.

@ldhenry
Copy link
Collaborator

ldhenry commented Jul 31, 2020

I'll prioritize #30 for now since it is affecting you more frequently. However, I do want to get to the bottom of this so please do post any logs if possible.

Thanks,
Henry

@wondersd
Copy link
Author

wondersd commented Aug 3, 2020

I was able to reproduce using:

resource "launchdarkly_environment" "test" {
  count = 200
  name = format("%v%v", "foo", count.index)
  key = format("%v%v", "foo", count.index)
  color = 200596
  project_key = "default"
}

it took several iterations of terraform apply and terraform destroy but eventually the problem appeared.

Some of the more notable sections (most of the log looks like regular log output)

2020/08/03 14:01:32 [DEBUG] launchdarkly_environment.test[60]: applying the planned Create change
2020/08/03 14:01:32 [WARN] Provider "registry.terraform.io/-/launchdarkly" produced an unexpected new value for launchdarkly_environment.test[57], but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .default_track_events: was null, but now cty.False
      - .default_ttl: was null, but now cty.NumberIntVal(0)
      - .require_comments: was null, but now cty.False
      - .confirm_changes: was null, but now cty.False
      - .secure_mode: was null, but now cty.False

This is seen on successful and failed attempts and the order displayed is inconsistent

2020/08/03 14:01:14 [DEBUG] launchdarkly_environment.test[28]: applying the planned Create change
2020-08-03T14:01:14.517-0400 [DEBUG] plugin.terraform-provider-launchdarkly_v1.3.2_x4: 2020/08/03 14:01:14 [WARN] failed to find environment with key "foo145" in project "default", removing from state
2020/08/03 14:01:14 [DEBUG] launchdarkly_environment.test[145]: apply errored, but we're indicating that via the Error pointer rather than returning it: Provider produced inconsistent result after apply: When applying changes to launchdarkly_environment.test[145], provider "registry.terraform.io/-/launchdarkly" produced an unexpected new value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.
2020/08/03 14:01:14 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: Provider produced inconsistent result after apply: When applying changes to launchdarkly_environment.test[145], provider "registry.terraform.io/-/launchdarkly" produced an unexpected new value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.
2020/08/03 14:01:14 [ERROR] <root>: eval: *terraform.EvalSequence, err: Provider produced inconsistent result after apply: When applying changes to launchdarkly_environment.test[145], provider "registry.terraform.io/-/launchdarkly" produced an unexpected new value for was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

@ldhenry
Copy link
Collaborator

ldhenry commented Aug 3, 2020

Excellent. Thanks for the resource and logs. This should help narrow things down.

@disposedtrolley
Copy link

Hey @ldhenry! I'm running into a similar issue at the moment. Have you managed to find the root cause?

@ldhenry
Copy link
Collaborator

ldhenry commented Apr 14, 2022

Hi @disposedtrolley,

We have been having trouble reproducing this error on our side. If possible can you share any relevant resource config and the output of terraform -v?

Thanks,
Henry

@rjauregui-ledger
Copy link

rjauregui-ledger commented Aug 16, 2022

Hello @ldhenry

I am currently using terraform provider version v2.8.0 and it looks like I am encountering same issue when using dynamic environments blocks

Here is the terraform -v result :

terraform -v
Terraform v1.2.3
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v4.26.0
+ provider registry.terraform.io/hashicorp/time v0.8.0
+ provider registry.terraform.io/launchdarkly/launchdarkly v2.8.0

Your version of Terraform is out of date! The latest version
is 1.2.7. You can update by downloading from https://www.terraform.io/downloads.html

In my situation, I am adding some new dynamic environments into an already existing project, and I am expecting to retrieve the client_side_id, api_key and mobile_key to store those into secrets manager.

When running a terraform apply with debug information, here is the log lines catching the issue.

022-08-16T17:21:32.287+0200 [WARN]  Provider "provider[\"registry.terraform.io/launchdarkly/launchdarkly\"]" produced an unexpected new value for module.vault_launchdarkly.launchdarkly_project.test["test"], but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .environments[1].client_side_id: inconsistent values for sensitive attribute
      - .environments[1].api_key: inconsistent values for sensitive attribute
      - .environments[1].mobile_key: inconsistent values for sensitive attribute

It appears those values are empty.

When applying a second time consecutively then it's working fine.

Would it be possible to investigate on that one ? Do you need me to open another ticket ? Do you want more information to reproduce that issue ?

@ldhenry
Copy link
Collaborator

ldhenry commented Aug 17, 2022

Hey @rjauregui-ledger,

I'm sorry to hear you're running into this issue. Would it be possible to provide us with a snippet of the resource that is causing you problems to help us better reproduce this issue?

By the way, if you are just looking to the client_side_id, api_key and mobile_key to store those into a secret manager have you considered using our luaunchdarkly_environment data source?

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

No branches or pull requests

4 participants