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

[Bug]: data "aws_default_tags" "tags" output return null instead empty map cause downstream function error. #27372

Closed
crjlty88 opened this issue Oct 21, 2022 · 5 comments · Fixed by #27377
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement.

Comments

@crjlty88
Copy link

Terraform Core Version

1.2.9

AWS Provider Version

4.36.0

Affected Resource(s)

data.aws_default_tags

Expected Behavior

data.aws_default_tags.example.tags returns empty map, this returns empty map in older versions.

Actual Behavior

data.aws_default_tags.example.tags returns null

Relevant Error/Panic Output Snippet

│   on .terraform\modules\jump_ec2_sg.context\main.tf line 41, in locals:
│   41:     } : k => v if lookup(data.aws_default_tags.provider.tags, k, null) == null || lookup(data.aws_default_tags.provider.tags, k, null) != v
│     ├────────────────
│     │ data.aws_default_tags.provider.tags is null
│
│ Invalid value for "inputMap" parameter: argument must not be null.

Terraform Configuration Files

data "aws_default_tags" "provider" {}

locals {
tags = {
for k, v in {
app_id = var.app_id
chargeback_id = local.chargeback_id
environment = local.workspace
product = var.product_name
} : k => v if lookup(data.aws_default_tags.provider.tags, k, null) == null || lookup(data.aws_default_tags.provider.tags, k, null) != v
}
all_tags = merge(local.tags, var.tags)
}

Steps to Reproduce

terraform init
terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No response

@crjlty88 crjlty88 added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Oct 21, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@crjlty88 crjlty88 changed the title [Bug]: [Bug]: data "aws_default_tags" "tags" output return null instead empty map cause downstream function error. Oct 21, 2022
@crjlty88
Copy link
Author

crjlty88 commented Oct 21, 2022

I do suspect this commit cause the behavior change for this issue.

b88ec64#diff-b5fa0211b5d847acdd947ec2883f8d4b5c26ed49d43ce64e2df81d2bc9554b14R79

@crjlty88
Copy link
Author

aws_default_tag-data-returns-null

@ewbankkit ewbankkit added regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/meta and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 21, 2022
@ewbankkit
Copy link
Contributor

For this configuration

provider "aws" {}

data "aws_default_tags" "test" {}

after terraform apply the corresponding state files are

v4.35.0
{
  "version": 4,
  "terraform_version": "1.0.9",
  "serial": 1,
  "lineage": "a36acc25-7b24-3722-9db9-d2a511f5a9bd",
  "outputs": {},
  "resources": [
    {
      "mode": "data",
      "type": "aws_default_tags",
      "name": "test",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "id": "aws",
            "tags": {}
          },
          "sensitive_attributes": []
        }
      ]
    }
  ]
}
v4.36.0
{
  "version": 4,
  "terraform_version": "1.0.9",
  "serial": 1,
  "lineage": "4c80dd1c-6f90-5d8a-383d-a86f23481cd8",
  "outputs": {},
  "resources": [
    {
      "mode": "data",
      "type": "aws_default_tags",
      "name": "test",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "id": "aws",
            "tags": null
          },
          "sensitive_attributes": []
        }
      ]
    }
  ]
}

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants