-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resource/aws_kinesis_firehose_delivery_stream: Support data_format_conversion_configuration #4842
resource/aws_kinesis_firehose_delivery_stream: Support data_format_conversion_configuration #4842
Conversation
…nversion_configuration
… and remove extraneous schema comments
… from API defaults for data_format_conversion_configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. I have a few questions about checking for Optional values, setting multiple serializers in a configuration, swapping between serializers (whether or not that is possible), and updating different attributes within a serializer. Also there are a ton of attributes that should be constants. I'm wondering if we could petition to have those available in the sdk instead of manually setting them here
// API omits default values | ||
// Return defaults that are not type zero values to prevent extraneous difference | ||
|
||
m["block_size_bytes"] = 268435456 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of values that could be better as constants in this PR. Do you think the aws sdk team would be down to put all of these defaults as constants in their sdk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the AWS SDK constants do not usually contain integer values and especially not bytes amounts. I can try submitting an upstream issue into https://github.com/aws/aws-sdk-go/ but it would be dependent on all the (distributed) AWS service teams implementing those constants into their JSON service models.
In this scenario, I'd almost wish for something more like 256 * XXX.Mebibytes
, similar to 1 * time.Minute
, but I'm not sure its worth vendoring in an external dependency for that simplification.
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"hive_json_ser_de": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when you set both hive_json_ser_de
and open_x_json_ser_de
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns an error. 😄 I added ConflictsWith
to both attributes here.
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"orc_ser_de": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. What happens when you set multiple ..._ser_de
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns an error. 😄 I added ConflictsWith
to both attributes here.
@@ -147,6 +147,168 @@ func TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3basic(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Enabled(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test updates disabled -> enabled but I'd love to see some other tests that update the different configurations and maybe swaps from one serializer to another if that is even an option. Hopefully that doesn't take too much work but I think it's necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I certainly agree. Let me write up tests that switch up the serializers and deserializers via update 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added two tests for updating deserializer and serializer:
make testacc TEST=./aws TESTARGS='-run=TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_\(Des\|S\)erializer_Update'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_\(Des\|S\)erializer_Update -timeout 120m
=== RUN TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update (316.20s)
=== RUN TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update (284.81s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 601.050s
config := &firehose.SchemaConfiguration{ | ||
DatabaseName: aws.String(m["database_name"].(string)), | ||
RoleARN: aws.String(m["role_arn"].(string)), | ||
TableName: aws.String(m["table_name"].(string)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional with no default. We should check to make sure it's actually in the config
|
||
config := &firehose.SchemaConfiguration{ | ||
DatabaseName: aws.String(m["database_name"].(string)), | ||
RoleARN: aws.String(m["role_arn"].(string)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional with no default. We should check to make sure it's actually in the config. It is set in all the tests so is it actually required when you specify schema_configuration
m := l[0].(map[string]interface{}) | ||
|
||
config := &firehose.SchemaConfiguration{ | ||
DatabaseName: aws.String(m["database_name"].(string)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional with no default. We should check to make sure it's actually in the config. It is set in all the tests so is it actually required when you specify schema_configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an odd case where we are following the API definition of required vs optional attributes according to: https://docs.aws.amazon.com/firehose/latest/APIReference/API_SchemaConfiguration.html
In these cases we generally prefer to follow the API versus making our own determination since there might be some implementation that does not require these details within the schema configuration (in this case, one that I personally do not know about). The API and user guide documentation do not provide any guidance why these are not required.
This comment applies to all the below as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followup for anyone looking at these comments, we decided to opt for Required: true
on these attributes for now. If there are any use cases for not providing the database/role/table in the schema configuration, hopefully a bug report will suss that out.
…h for serializers/deserializers Previously just an API error: aws_kinesis_firehose_delivery_stream.test: error creating Kinesis Firehose Delivery Stream: InvalidArgumentException: More than one deserializer specified. Only one may be chosen. Now a Terraform validation error: - aws_kinesis_firehose_delivery_stream.test: "extended_s3_configuration.0.data_format_conversion_configuration.0.input_format_configuration.0.deserializer.0.hive_json_ser_de": conflicts with extended_s3_configuration.0.data_format_conversion_configuration.0.input_format_configuration.0.deserializer.0.open_x_json_ser_de - aws_kinesis_firehose_delivery_stream.test: "extended_s3_configuration.0.data_format_conversion_configuration.0.input_format_configuration.0.deserializer.0.open_x_json_ser_de": conflicts with extended_s3_configuration.0.data_format_conversion_configuration.0.input_format_configuration.0.deserializer.0.hive_json_ser_de
…o serializer and deserializer make testacc TEST=./aws TESTARGS='-run=TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_\(Des\|S\)erializer_Update' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -run=TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_\(Des\|S\)erializer_Update -timeout 120m === RUN TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update --- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update (316.20s) === RUN TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update --- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update (284.81s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 601.050s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…rsion_configuration schema_configuration database/role/table as required for now
This has been released in version 1.24.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Closes #4510
Changes proposed in this pull request:
data_format_conversion_configuration
and sub-argumentsReferences:
Output from acceptance testing: