Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform find s3 bucket by tag

Is it possible to find s3 bucket by tag?

Let's assume that I've created an bucket: 12345-bucket-54321 and I added a tag (bucket:mypersonalbucket).

Is it possible to find this bucket in Terraform by tag?

I'm looking for something similar to: https://www.terraform.io/docs/providers/aws/d/ami.html#filter

like image 284
Michal Avatar asked Oct 27 '25 09:10

Michal


1 Answers

Currently (04/26/19) it is not possible to get an S3 bucket by tag. If you look at the documentation when attempting to get an s3 bucket as a data source you can only perform lookup by the bucket name i.e.

data "aws_s3_bucket" "selected" {
 bucket = "bucket_name"
}

One thing you might want to do is open a feature request with the Terraform AWS Provider on Github requesting this functionality.

like image 155
hpoe Avatar answered Oct 30 '25 00:10

hpoe