-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Add import support for kinesis firehose delivery stream #2082
Conversation
@radeksimko I'm able to import a firehose stream with this code.
It's putting the What am I missing here? 🤔 |
@radeksimko Ping 😄 |
@radeksimko I just realized that terraform import current works only with id, not name. Please let me know if something else is needed to get this merged. EDIT: Not sure why the test is failing. EDIT2: Test was breaking due to upstream changes in #2055. Fixed now. |
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { | ||
resARN, err := arn.Parse(d.Id()) | ||
if err != nil { | ||
return []*schema.ResourceData{}, err |
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.
@radeksimko Is this okay or should it be return nil, err
instead?
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 likely doesn't matter if a non-nil error is returned - so returning nil
here is nicer.
2d1caa9
to
d5c2d6d
Compare
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.
A couple of minior changes and comments - other than that this looks good to me! If you could squash this down to one commit, I'll go ahead and merge it.
import ( | ||
"testing" | ||
|
||
"fmt" |
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.
goimports
needs running here
@@ -6,9 +6,12 @@ import ( | |||
"strings" | |||
"time" | |||
|
|||
"bytes" |
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 re goimports
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { | ||
resARN, err := arn.Parse(d.Id()) | ||
if err != nil { | ||
return []*schema.ResourceData{}, err |
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 likely doesn't matter if a non-nil error is returned - so returning nil
here is nicer.
@jen20 Done changes as per the review. The "squash and merge" button should combine the commits as one before adding to master. |
I was trying to add support for S3 Backup (#2699) when I found that this modification doesn't handle S3 basic vs extended configuration correctly. Essentially when you create a Kinesis Delivery Stream with an S3 destination:
and describe the Delivery Stream:
AWS returns configuration for both S3DestinationDescription (Basic) and ExtendedS3DestinationDescription (Extended), it looks like they cloned the settings from the extended section to the basic one. I've also checked that when you create with basic-only configuration (deprecated) AWS also creates the extended config equivalent. The issue comes when creating the resource state at https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_kinesis_firehose_delivery_stream.go#L272 as S3DestinationDescription is always populated (even when created with extended configuration) the destination is forced to "s3" (basic) and the state doesn't reflect everything associated with the resource and prevents the use of functionality offered by the extended configuration (Lambda Processing, S3 Backup etc...). Subsequently, terraform I was looking to create a patch for this but it's not clear to me how to choose the destination correctly as there's nothing in the description of the Delivery Stream which would denote whether it was created with basic or extended configuration. Part of me would suggest converting everything to extended configuration given basic is deprecated but my experience of terraform is less than 8 hours so not sure if that's the best approach :) |
@dennisatspaceape Ah, I missed that. So that basically means if I create a stream via aws cli, and I forget if I used basic or extended, there's no way to find out? |
@ApsOps I used the AWS CLI purely to see the metadata behind the Delivery Stream. If you create a Delivery Stream with extend_s3 configuration in terraform and then run Looking at the AWS metadata behind the Delivery Stream I don't believe it's possible to know if the creation was done with basic or extended configuration. If you create a basic S3 delivery stream (deprecated) AWS will also initialize the applicable extended configuration properties and vice versa. |
@radeksimko @jen20 Do you have any ideas on how we can check if a stream was created with Or should we also make |
@radeksimko @jen20 Any chance of some feedback on this? |
(Sorry I don't have feedback from the post-merge discussion as I'm just going through and post-release commenting, but my suggestion would be to ensure each bug captured in an issue somewhere rather than this PR for quick resolution. We are planning a 1.7.1 bugfix release.) The functionality of this PR (which given by the post-merge comments above might not be 100%) has been released in terraform-provider-aws version 1.7.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
CHANGELOG: Fix link to 1.7.0 released #2082
@dennisatspaceape Sorry for the trouble. I've fixed the broken functionality in #2970. It would be great if you could test and confirm that it works for you. 🙂 @bflad Please see if #2970 could be merged soon since this is broken right now. |
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! |
@radeksimko Right now, I've just added import support just for Redshift destination. I want to make sure I'm on the right track.
cloudwatch_logging_options
aren't working yet. Looks like it expects*schema.Set
and I'm givingmap[string]interface{}
. How do we handle this?EDIT: We use "flatteners" to create required
*schema.Set
for converting*awsservice.Struct
to[]map[string]interface{}
.TODO: