Skip to content
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 aws_cloudwatch_log_subscription_filter #8165

Conversation

teraken0509
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #8147

Changes proposed in this pull request:

  • add import support for aws_cloudwatch_log_subscription_filter resource

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudwatchLogSubscriptionFilter_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSCloudwatchLogSubscriptionFilter_ -timeout 120m
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_basic
=== PAUSE TestAccAWSCloudwatchLogSubscriptionFilter_basic
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_disappears
=== PAUSE TestAccAWSCloudwatchLogSubscriptionFilter_disappears
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup
=== PAUSE TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup
=== CONT  TestAccAWSCloudwatchLogSubscriptionFilter_basic
=== CONT  TestAccAWSCloudwatchLogSubscriptionFilter_disappears
=== CONT  TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears (48.92s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup (49.19s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_basic (53.27s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	53.347s

@ghost ghost added size/S Managed by automation to categorize the size of a PR. service/cloudwatchlogs tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Apr 3, 2019
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Apr 4, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, @kterada0509, thanks! 🚀 I'll fix up the little error message thing on merge.

Output from acceptance testing:

--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_basic (23.84s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears (24.66s)
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup (24.77s)


## Import

CloudWatch Logs subscription filter can be imported using the log group name and subscription filter name separated by `|`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We really need to document and start standardizing on a single import separator. 😅 Preferably this would be something more like a , comma to not interfere with the shell | pipe operator, but not going to stop this pull request over this as it is something we should address holistically across the provider. (Maybe commas won't be right either.)

func resourceAwsCloudwatchLogSubscriptionFilterImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
idParts := strings.Split(d.Id(), "|")
if len(idParts) < 2 {
return nil, fmt.Errorf("unexpected format of ID (%q), expected <log-group-name>/<filter-name-prefix>", d.Id())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error should use | not / 😄

Suggested change
return nil, fmt.Errorf("unexpected format of ID (%q), expected <log-group-name>/<filter-name-prefix>", d.Id())
return nil, fmt.Errorf("unexpected format of ID (%q), expected <log-group-name>|<filter-name>", d.Id())

@bflad bflad added this to the v2.5.0 milestone Apr 4, 2019
@bflad bflad merged commit 467d1c2 into hashicorp:master Apr 4, 2019
@bflad
Copy link
Contributor

bflad commented Apr 5, 2019

This has been released in version 2.5.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@teraken0509 teraken0509 deleted the feature/add-import-for-aws_cloudwatch_log_subscription_filter-resource branch March 5, 2020 14:02
@ghost
Copy link

ghost commented Mar 5, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Import Support for aws_cloudwatch_log_subscription_filter
2 participants