Providing a more informative error message when combining kms_key_id and etag as well as using aws_kms_key to test aws_s3_bucket's kms_key_id.
This commit is contained in:
parent
74de6531fe
commit
76b3c74a58
|
@ -124,7 +124,7 @@ func resourceAwsS3BucketObjectPut(d *schema.ResourceData, meta interface{}) erro
|
||||||
|
|
||||||
if _, ok := d.GetOk("kms_key_id"); ok {
|
if _, ok := d.GetOk("kms_key_id"); ok {
|
||||||
if _, ok := d.GetOk("etag"); ok {
|
if _, ok := d.GetOk("etag"); ok {
|
||||||
return fmt.Errorf("Unable to specify kms_key_id and etag on the same object")
|
return fmt.Errorf("Unable to specify 'kms_key_id' and 'etag' together because 'etag' wouldn't equal the MD5 digest of the raw object data")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,6 +343,9 @@ resource "aws_s3_bucket_object" "object" {
|
||||||
|
|
||||||
func testAccAWSS3BucketObjectConfig_withKMSId(randInt int) string {
|
func testAccAWSS3BucketObjectConfig_withKMSId(randInt int) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
|
resource "aws_kms_key" "kms_key_1" {
|
||||||
|
}
|
||||||
|
|
||||||
resource "aws_s3_bucket" "object_bucket_2" {
|
resource "aws_s3_bucket" "object_bucket_2" {
|
||||||
bucket = "tf-object-test-bucket-%d"
|
bucket = "tf-object-test-bucket-%d"
|
||||||
}
|
}
|
||||||
|
@ -351,7 +354,7 @@ resource "aws_s3_bucket_object" "object" {
|
||||||
bucket = "${aws_s3_bucket.object_bucket_2.bucket}"
|
bucket = "${aws_s3_bucket.object_bucket_2.bucket}"
|
||||||
key = "test-key"
|
key = "test-key"
|
||||||
content = "stuff"
|
content = "stuff"
|
||||||
kms_key_id = "01961aed-d0b6-4ad3-9f7f-8264818ea611"
|
kms_key_id = "${aws_kms_key.kms_key_1.key_id}"
|
||||||
}
|
}
|
||||||
`, randInt)
|
`, randInt)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue