Loading...
Loading...
consider the following module ``` terraform --version Terraform v0.15.5 on linux_amd64 + provider registry.terraform.io/hashicorp/aws v3.36.0 ``` ``` # bucket .tf resource "aws_s3_bucket" "b" { bucket = "skeswani-foo-bucket" acl = "private" depends_on = [ aws_s3_bucket_object.tffile2 ] tags = { Name = "My bucket" Environment = "Dev" } } resource "aws_s3_bucket_object" "tffile1" { bucket = aws_s3_bucket.b.id key = "bucket.tf" source = "./bucket.tf" etag = filemd5("./bucket.tf") } resource "aws_s3_bucket_object" "tffile2" { bucket = "myfoo-public" key = "bucket.tf" source = "./bucket.tf" etag = filemd5("./bucket.tf") } # output.tf output "mybucket" { value = aws_s3_bucket.b } output "file1" { value = aws_s3_bucket_object.tffile1 } output "file2" { value = aws_s3_bucket_object.tffile2 } ``` Apply it ``` $ terraform apply --auto-approve 1>/dev/null $ terraform output file1 = "bucket.tf" file2 = "bucket.tf" mybucket = "skeswani-foo-bucket" ``` do something to make destory fail ! here we add a file so bucket destroy will fail ``` $ aws s3 cp ./output.tf s3://skeswani-foo-bucket/ $ terraform destroy --auto-approve 1>/dev/null ╷ │ Error: error deleting S3 Bucket (skeswani-foo-bucket): BucketNotEmpty: The bucket you tried to delete is not empty │ status code: 409, request id: BOO BOO, host id: blahblah ``` as expected the bucket and the dependent objects not destroyed ``` $ terraform show | grep "# " # aws_s3_bucket.b: # aws_s3_bucket_object.tffile2: ``` **BUG: So why is there no output to indicate the existence of these resources. esp dependent resources** ``` $ terraform output ╷ │ Warning: No outputs found <==== BUG !!, these resources exist so why are they not in the OUTPUT │ │ The state file either has no outputs defined, or all the defined outputs are empty. Please define an output in your configuration with the `output` keyword and run `terraform refresh` for it to become available. If you are using │ interpolation, please verify the interpolated value is not empty. You can use the `terraform console` command to assist. ╵ $ cat terraform.tfstate | jq '.outputs' {} $ aws s3 ls s3://myfoo-public/bucket.tf 2021-07-29 13:41:40 515 bucket.tf ```
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.