-
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
redshift event subscription resource #6146
Conversation
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.
Hi @f0rk 👋 Thanks for submitting this! Initial feedback below. Please let us know if you have any questions or do not have time to implement it.
Update: resourceAwsRedshiftEventSubscriptionUpdate, | ||
Delete: resourceAwsRedshiftEventSubscriptionDelete, | ||
Importer: &schema.ResourceImporter{ | ||
State: resourceAwsRedshiftEventSubscriptionImport, |
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.
Since the Read function already uses d.Id()
, we can remove the custom import function here and use schema.ImportStatePassThrough
instead. 👍
SubscriptionName: aws.String(name), | ||
SnsTopicArn: aws.String(d.Get("sns_topic").(string)), | ||
Enabled: aws.Bool(d.Get("enabled").(bool)), | ||
SourceIds: sourceIds, |
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.
The logic above can all be replaced with SourceIds: expandStringSet(d.Get("source_ids").(*schema.Set)),
😄
SourceIds: sourceIds, | ||
SourceType: aws.String(d.Get("source_type").(string)), | ||
Severity: aws.String(d.Get("severity").(string)), | ||
EventCategories: eventCategories, |
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 -- the logic above can all be replaced with EventCategories: expandStringSet(d.Get("event_categories").(*schema.Set)),
😄
name = resource.UniqueId() | ||
} | ||
|
||
tags := tagsFromMapRedshift(d.Get("tags").(map[string]interface{})) |
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.
Nit: Since the tags
variable isn't used anywhere else in this function, this can be moved inside CreateEventSubscriptionInput
, e.g. Tags: tagsFromMapRedshift(d.Get("tags").(map[string]interface{}))
Required: true, | ||
ForceNew: true, | ||
}, | ||
"sns_topic": { |
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.
Two things here:
- We should rename this
sns_topic_arn
to match the Redshift API as well as be more explicit about what the argument is looking for. - We can add plan-time validation for this via:
ValidateFunc: validateArn,
master_username = "default" | ||
master_password = "default" | ||
|
||
... |
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.
We generally prefer to omit the configuration of other referenced resources in the example configurations due to their maintenance burden, but if this is being left here, we should ensure its valid HCL by making sure this is a comment, e.g. # ... other configuration ...
|
||
The following arguments are supported: | ||
|
||
* `name` - (rEquired) The name of the Redshift event subscription. |
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.
Typo: rEquired
should be Required
The following arguments are supported: | ||
|
||
* `name` - (rEquired) The name of the Redshift event subscription. | ||
* `sns_topic` - (Required) The SNS topic to send events to. |
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 should explicitly mention it is the ARN of the SNS topic (after updating attribute name). 👍
* `name` - (rEquired) The name of the Redshift event subscription. | ||
* `sns_topic` - (Required) The SNS topic to send events to. | ||
* `source_ids` - (Optional) A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified. | ||
* `source_type` - (Optional) The type of source that will be generating the events. Valid options are `cluster`, `cluster-parameter-group`, ``, `cluster-security-group`, or` cluster-snapshot`. If not set, all sources will be subscribed to. |
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.
The formatting here is a little off:
- Extraneous
``,
- Last item should be
or `cluster-snapshot`
Also, I'm guessing that the linting failure is coming from running Go 1.10 or earlier. If you update to Go 1.11 and |
@bflad thanks for the feedback! I should be able to get to these enhancements and fixes soon |
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.
Looks good, thanks @f0rk! 🚀
--- PASS: TestAccAWSRedshiftEventSubscription_withPrefix (4.70s)
--- PASS: TestAccAWSRedshiftEventSubscription_categoryUpdate (7.31s)
--- PASS: TestAccAWSRedshiftEventSubscription_basicUpdate (7.58s)
--- PASS: TestAccAWSRedshiftEventSubscription_withSourceIds (7.90s)
This has been released in version 1.41.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! |
Changes proposed in this pull request:
aws_redshift_event_subscription
resource.Output from acceptance testing:
Sorry about the large diff in aws/provider.go.