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

Resource newrelic_workload: Workload Resource rule fails without nrql_query #2751

Open
6 tasks done
smailc opened this issue Oct 3, 2024 · 1 comment
Open
6 tasks done

Comments

@smailc
Copy link

smailc commented Oct 3, 2024

Hi there,

Thank you for opening an issue. In order to better assist you with your issue, we kindly ask to follow the template format and instructions. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests only. General usage questions submitted as issues will be closed and redirected to New Relic's Explorers Hub https://discuss.newrelic.com/c/build-on-new-relic/developer-toolkit.

Please include the following with your bug report

⚠️ Important: Failure to include the following, such as omitting the Terraform configuration in question, may delay resolving the issue.

Terraform Version

1.5.7

Affected Resource(s)

newrelic_workload

Terraform Configuration

Please include your provider configuration (sensitive details redacted) as well as the configuration of the resources and/or data sources related to the bug report.

    newrelic = {
      source  = "newrelic/newrelic"
      version = "~> 3.0"
    }

    rule {
      entity_guids = ["<guid_id>"]
      #nrql_query {
      #  query = "name like '%Example application2%'"
      #}
      rollup {
        strategy        = "BEST_STATUS_WINS"
        threshold_type  = "FIXED"
        threshold_value = 100
      }
    }

Actual Behavior

Rule should apply when at least one of entity_guids or nrql_query is specified. However if you don't specify nrql_query it fails with the following message:

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to newrelic_workload.foo, provider
│ "provider[\"registry.terraform.io/newrelic/newrelic\"]" produced an
│ unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Expected Behavior

It should apply without failing

Steps to Reproduce

Setup workload resource as per Terraform doc. Create a rule with entity_guids and nrql_query. Apply and it will work fine. If you then remove nrql_query block from the rule it will fail.

@pranav-new-relic pranav-new-relic changed the title Workload resource rule failes without nrql_query Resource newrelic_workload: Workload Resource rule fails without nrql_query Oct 8, 2024
@pranav-new-relic
Copy link
Member

pranav-new-relic commented Oct 8, 2024

Hi @smailc, I don't seem to be able to reproduce this issue - in my case,

  • neither does removing the nrql_query{} block from the rule{} after the first terraform apply to leave only entity_guids in the rule{} and then performing a terraform apply lead to an error
  • nor does performing the first terraform apply with only the entity_guids in the nrql_query{} block lead to an error

It could be that there's a different issue under the hood causing this. Would you be able to share the debug logs of the terraform apply operation when you see this error, by setting TF_LOG=TRACE or TF_LOG=DEBUG? Based on the API responses seen in the logs, I shall be able to advise accordingly, or redirect this to the right team here at New Relic for further investigation. Thanks!

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

No branches or pull requests

2 participants