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_cloud_gcp_integrations: Now Requires Optional Properties to be Set to Avoid Drift #2767

Open
a88zach opened this issue Oct 28, 2024 · 3 comments

Comments

@a88zach
Copy link

a88zach commented Oct 28, 2024

Terraform Version

Terraform v1.9.8 on darwin_arm64

Affected Resource(s)

Please list the resources as a list, for example:

  • newrelic_cloud_gcp_integrations

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

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.

resource "newrelic_cloud_gcp_link_account" "prod" {
  project_id = "prod"
  name       = "prod"
}

resource "newrelic_cloud_gcp_integrations" "prod" {
  linked_account_id = newrelic_cloud_gcp_link_account.prod.id
  big_query {}
  functions {}
  redis {}
  run {}
  virtual_machines {}
}

Actual Behavior

With the above configuration, the integration blocks are removed from the integration

Expected Behavior

The integration blocks should use the default values for fetch_tags and metrics_polling_interval

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

This happens when moving from 3.51.0 to 3.52.0
This is fixed by adding the defaults to the integration blocks

resource "newrelic_cloud_gcp_integrations" "prod" {
  linked_account_id = newrelic_cloud_gcp_link_account.prod.id
  big_query {
    fetch_tags               = true
    metrics_polling_interval = 300
  }
  functions {
    metrics_polling_interval = 300
  }
  redis {
    metrics_polling_interval = 300
  }
  run {
    metrics_polling_interval = 300
  }
  virtual_machines {
    metrics_polling_interval = 300
  }
}
@a88zach a88zach changed the title newrelic_cloud_gcp_integrations no requires optional properties to be set newrelic_cloud_gcp_integrations now requires optional properties to be set Oct 28, 2024
@pranav-new-relic
Copy link
Member

pranav-new-relic commented Oct 29, 2024

Hi @a88zach, I just tried reproducing this, and this seems to be the case with earlier versions of the provider too, such as 3.51.0, 3.40.0 and many more in the past. This seems to have been the behaviour for quite some time now, given the Terraform Provider does not have defaulting behaviour of the metrics_polling_interval, etc; we generally do not add such rigid default values to avoid concerns when such default values are changed upstream.

Can you please test this on 3.51.0 and previous versions and let us know if you're seeing the same behaviour too? This would help conclude that this is not a breaking change caused in 3.52.0 (while that is not possible, considering no changes were made to the newrelic_cloud_gcp_integrations resource).

@pranav-new-relic pranav-new-relic changed the title newrelic_cloud_gcp_integrations now requires optional properties to be set Resource newrelic_cloud_gcp_integrations: Now Requires Optional Properties to be Set to Avoid Drift Oct 29, 2024
@a88zach
Copy link
Author

a88zach commented Oct 29, 2024

@pranav-new-relic, my hunch here is that something may have changed in the nerdgraph, but I cannot find that code to verify.

I now get the same result using both 3.52.0 and 3.51.0, but my configuration hasn't changed since 3.30.0 (see below)

resource "newrelic_cloud_gcp_integrations" "prod" {
  linked_account_id = newrelic_cloud_gcp_link_account.prod.id
  big_query {}
  functions {}
  redis {}
  run {}
  virtual_machines {}
}

However, with this configuration, a new plan is created each time that tries to remove the integrations default arguments. If you set up a resource like above, and run an apply multiple times without changing the resource, you should see the issue.

According to the docs for this resource the integration arguments are all optional with defaults

@pranav-new-relic
Copy link
Member

@a88zach I kinda agree with you - after having gone through the code again, I seem to realise this is probably not how the resource behaved so far; why I still am not (and was previously not) 100% sure is because the API did exhibit such flakey behaviour occasionally in the past, I'm wondering if that is a similar scenario.

I'll try checking with the API folks here at New Relic to see if they've changed something that's causing this behavior.

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

2 participants