Terraform plan/apply ignore data source 'read' messages

Hi Terraform Team, When I am doing Terraform ‘plan/apply,’ I get a lot of outputs from ‘data sources’ as below. Please let me know why these occur?. And how to avoid them. These outputs from ‘data sources’ mask actual/critical changes in terraform ‘plan/apply.’

Thanks in advance.

 # data.aws_secretsmanager_secret.secret will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_secretsmanager_secret" "secret" {
      + arn               = (known after apply)
      + created_date      = (known after apply)
      + description       = (known after apply)
      + id                = (known after apply)
      + kms_key_id        = (known after apply)
      + last_changed_date = (known after apply)
      + name              = "admin-core-sandbox"
      + policy            = (known after apply)
      + tags              = (known after apply)
    }

<= data "aws_caller_identity" "current" {
      + account_id = (known after apply)
      + arn        = (known after apply)
      + id         = (known after apply)
      + user_id    = (known after apply)
    }

Hi @coolbreeze,

These messages will appear in any case where Terraform must defer reading the data resource until the apply step, to warn you that this information isn’t known yet and won’t be known until after you apply.

If you don’t want to see these messages then you’ll need to change how you use these data resources so that all of the information they need is known during the planning step, and so that they don’t depend on any managed resources (resource blocks) which therefore require Terraform to wait until the managed resource actions have been applied before reading the data source.

Thanks @apparentlymart . Let me analyze and create an example to show what I am doing. I am just calling ‘data source’ in ‘live-infrastructure’ and my customers ‘module’ to fetch information about resources built by other modules. Is there any best practices article/post which defines how to use ‘data source’?

PS:- How do you get time to answer almost every post? Thanks for your support.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.