Skip to content

Dynamic blocks do not fix the order in which listings are processed #1720

Closed
@melumuccu

Description

Terraform Version

# tf -v
Terraform v1.1.7
on linux_amd64
+ provider registry.terraform.io/newrelic/newrelic v2.39.2

# tf providers

Providers required by configuration:
.
├── provider[registry.terraform.io/newrelic/newrelic] 2.39.2
├── module.base
│   └── provider[registry.terraform.io/newrelic/newrelic]
├── module.future
│   └── provider[registry.terraform.io/newrelic/newrelic]
├── module.nrql
│   └── provider[registry.terraform.io/newrelic/newrelic]
├── module.past
│   └── provider[registry.terraform.io/newrelic/newrelic]
├── module.synthetics_monitor
│   └── provider[registry.terraform.io/newrelic/newrelic]
├── module.time_unit
│   └── provider[registry.terraform.io/newrelic/newrelic]
└── module.urls
    └── provider[registry.terraform.io/newrelic/newrelic]

Providers required by state:

    provider[registry.terraform.io/newrelic/newrelic]

Affected Resource(s)

  • newrelic_one_dashboard

Terraform Configuration

  • main.tf
terraform {
  required_version = "~> 1.0"
  required_providers {
    newrelic = {
      version = "2.39.2"
      source = "newrelic/newrelic"
    }
  }
}

provider "newrelic" {}
  • test.tf
//-------------------------------------
// resource
//-------------------------------------
resource "newrelic_one_dashboard" "test_lighthouse" {
  name = "(test)Lighthouse_goonet-prod"
  page {
    name = "lighthouse"
    dynamic "widget_line" {
      for_each = local.test_targets
      iterator = target
      content {
        title  = module.urls.urls["${target.value}"].url_name
        row    = target.key + 1
        column = 1     
        nrql_query {
          query = <<EOF
${module.nrql.nrql["lighthouse_dashboard"].nrql1}  average(custom.performanceScore) AS 'desktop'
${module.nrql.nrql["lighthouse_dashboard"].nrql2}  monitorName = '(test)LIGHTHOUSE - ${target.key} - desktop'
${module.nrql.nrql["lighthouse_dashboard"].nrql3}
          EOF
        }
      }
    }
  }
}
//-------------------------------------
// locals
//-------------------------------------
locals {
  test_targets = [
    "https://www.goo-net.com/",
    "https://www.goo-net.com/catalog/TOYOTA/",
    "https://www.goo-net.com/catalog/TOYOTA/ALPHARD/",
    "https://www.goo-net.com/magazine/",
  ]
}

Actual Behavior

After "apply", "change" was detected when "plan" was performed without modifying any source code.

Expected Behavior

No "change" was detected

Steps to Reproduce

  1. $ terraform apply
  2. $ terraform plan

logs
https://gist.github.com/melumuccu/2d9254ff3cf3d0135fef2b30cc6c4ac0

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions