hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.19k forks source link

[Enhancement]: Simple data source for cost allocation tags #31442

Open maunzCache opened 1 year ago

maunzCache commented 1 year ago

Description

As requested in #25243 i'd like to have a data source which calls the ListCostAllocationTags API. The mentioned issue was closed by the assumption that #25272 closes the issue in Terraform 4.20.0. However, this only provides the resource and not the data source to look up cost allocation tags.

A remediation for this issue was introduced by the data source "aws_ce_tags", but this is too verbose and covers another use case.

The behavior i wish for should match the return of the ListCostAllocationTags API.

My use case is to activate a bunch of tags in the cost allocation. AWS does only allow to activate tags in the cost allocation after they have been used for ~24 hours. This means if you create a new tag which should be a cost allocation tag, terraform apply will fail. The reason is that the tag has not yet been scraped and is unavailable for usage in cost allocation.

A possible workaround for this issue would be to gather the list of available cost allocation tags with the status of "Inactive" and match those against the list of tags i want to have activated. This keeps my runs clean from errors.

I do acknowledge, that this does not solve the general error and that i have to run another apply until the tags can be used for cost allocation.

Even though i would like to implement this, my hardware is unable to compile the current code base. So i won't be able to do it.

Affected Resource(s) and/or Data Source(s)

Not sure how the resource would be called.

Potential Terraform Configuration

data "aws_ce_cost_allocation_tags" "aws_generated" {
  status   = "Active" # Or "Inactive"
  tag_keys = ["tag-a", "tag-b"] # set(string) of tag keys to look up
  type     = "AWSGenerated" # Or "UserDefined"
}

References

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue