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.8k stars 9.15k forks source link

[Enhancement]: aws_s3_object content attribute with ignore_changes #32302

Open skeggse opened 1 year ago

skeggse commented 1 year ago

Description

Provide the content of an aws_s3_object resource as an attribute. This would let us manage an aws_s3_object resource in one place, and consume the content provided by an external system via the object.

The alternative would be to have a resource and a data source for the same object, which means that the first apply wouldn't work due to the object not existing yet.

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

Potential Terraform Configuration

resource "aws_s3_object" "example" {
  bucket = "example"
  key    = "example.json"

  content      = jsonencode([])
  content_type = "application/json"

  lifecycle {
    ignore_changes = [content, metadata]
  }
}

# If something else changes the content of the S3 object, this should be different on next plan/apply.
output "s3_content" {
  value = aws_s3_object.example.content
}

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue