newrelic / terraform-provider-newrelic

Terraform provider for New Relic
https://registry.terraform.io/providers/newrelic/newrelic/latest/docs
Mozilla Public License 2.0
202 stars 245 forks source link

Error when executing terraform plan that there is no matching CloudIntegration. #2652

Closed kenmatsu07 closed 5 months ago

kenmatsu07 commented 5 months ago

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

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

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

✗ terraform version
Terraform v1.6.4
on darwin_arm64
+ provider registry.terraform.io/cloudflare/cloudflare v3.35.0
+ provider registry.terraform.io/hashicorp/archive v2.4.2
+ provider registry.terraform.io/hashicorp/aws v5.16.2
+ provider registry.terraform.io/hashicorp/random v3.6.1
+ provider registry.terraform.io/hashicorp/tls v4.0.5
+ provider registry.terraform.io/newrelic/newrelic v3.27.1

Affected Resource(s)

Please list the resources as a list, for example:

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.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our [GPG public key](https://github.com/newrelic/observability-as-code/blob/master/docs/developer-toolkit.asc).
# For more information on how to encrypt files check out the [GPG Privacy handbook](https://www.gnupg.org/gph/en/manual/x110.html).
# Stream integration between New Relic and My AWS account
# --------------------------------------------------------------------------------
resource "newrelic_cloud_aws_link_account" "newrelic_cloud_integration_push" {
  account_id             = var.new_relic_account_id  # My NewRelic Account ID
  arn                          = aws_iam_role.newrelic_aws_role.arn
  metric_collection_mode = "PUSH"
  name                   = "${local.resource_prefix} push"
  depends_on             = [aws_iam_role_policy_attachment.newrelic_aws_policy_attach]
}

Actual Behavior

What actually happened?

At least until 2024/05/01 20:00 (JST), no errors occurred with the above code. The terraform plan and terraform apply commands were also executing with no syntax errors. I have not updated terraform or provider. No changes were made to the source code.

However, at the time of submitting the issue (2024/05/07 19:00 JST time), the following error suddenly occurred and I am confused.

Planning failed. Terraform encountered an error while generating this plan.

│ Error: interface CloudIntegration was not matched against all PossibleTypes: CloudAwsMsElasticacheIntegration
│ 
│   with newrelic_cloud_aws_link_account.newrelic_cloud_integration_push,
│   on newrelic.tf line 80, in resource "newrelic_cloud_aws_link_account" "newrelic_cloud_integration_push":
│   80: resource "newrelic_cloud_aws_link_account" "newrelic_cloud_integration_push" {

According to the terraform reference, I don't see a problem with the code. https://registry.terraform.io/providers/newrelic/newrelic/3.27.1/docs/resources/cloud_aws_link_account

I tried to update the newrelic plugin to the latest v3.35.1, but got the same error.

Expected Behavior

What should have happened?

The terraform plan and terraform apply commands were also executing with no syntax errors.

Steps to Reproduce

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

  1. terraform apply
  1. terraform apply at 2024/05/01 20:00 (JST) and terminate successfully
  2. terraform plan on 2024/05/07 15:00 (JST), but the error mentioned above occurred.
  3. Updated NewRelic provider version to 3.35.1, same error.

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs? Noting.

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

pranav-new-relic commented 5 months ago

Hi @kenmatsu07, this is being addressed in #2650 - would request you to watch the other issue for updates. Thank you!

pranav-new-relic commented 5 months ago

Re: https://github.com/newrelic/terraform-provider-newrelic/issues/2650#issuecomment-2098519290