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

resource/aws_cloudwatch_log_subscription_filter: Add support for distribution #3046

Merged
merged 2 commits into from
Jan 25, 2018
Merged

resource/aws_cloudwatch_log_subscription_filter: Add support for distribution #3046

merged 2 commits into from
Jan 25, 2018

Conversation

ryandeivert
Copy link
Contributor

resolves: #2853

Changes

  • Adding support for the optional distribution attribute to the aws_cloudwatch_log_subscription_filter resource.
  • Updating acceptance tests for the new attribute.
  • Updating docs for the website for the aws_cloudwatch_log_subscription_filter resource to include the distribution attribute.

Testing

  • Built the provider locally and created the resource aws_cloudwatch_log_subscription_filter:

main.tf:

resource "aws_cloudwatch_log_group" "rd_logs" {
  name              = "rd_logs"
  retention_in_days = 1
}

resource "aws_cloudwatch_log_subscription_filter" "test_log_filter" {
  name            = "test_log_filter"
  log_group_name  = "${aws_cloudwatch_log_group.rd_logs.name}"
  filter_pattern  = "[version, account]"
  destination_arn = "<omitted>"
  distribution    = "Random"
}

output of terraform plan:

Terraform will perform the following actions:

  + aws_cloudwatch_log_group.rd_logs
      id:                <computed>
      arn:               <computed>
      name:              "rd_logs"
      retention_in_days: "1"

  + aws_cloudwatch_log_subscription_filter.test_log_filter
      id:                <computed>
      destination_arn:   "<omitted>"
      distribution:      "Random"
      filter_pattern:    "[version, account]"
      log_group_name:    "rd_logs"
      name:              "test_log_filter"
      role_arn:          <computed>

Plan: 2 to add, 0 to change, 0 to destroy.

verification with awscli after apply:

$ aws logs describe-subscription-filters --log-group-name rd_logs
{
    "subscriptionFilters": [
        {
            "filterPattern": "[version, account]", 
            "filterName": "test_log_filter", 
            "creationTime": 1516255168390, 
            "logGroupName": "rd_logs", 
            "destinationArn": "<omitted>", 
            "distribution": "Random"
        }
    ]
}
  • Also tested with a handful of invalid values, etc.
  • Re-applying with the distribution attribute omitted will cause the resource to default to the `"ByLogStream" value.

@radeksimko radeksimko changed the title adding support for distribution in cw subscription filters. resolves #2853 resource/aws_cloudwatch_log_subscription_filter: Add support for distribution Jan 18, 2018
@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. service/cloudwatchlogs labels Jan 18, 2018
@ryandeivert
Copy link
Contributor Author

Hi @radeksimko I'm curious if anything else is needed from me for this? Would it be at all possible to get this slated for a release milestone? If so, since it's a small change and would be backwards compatible, could this happen in a patch version (1.7.2?) prior to 1.8.0?

Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Hey @ryandeivert

This is looking good, thanks for the work. 👍 🚀
I allowed myself to update the test for formatting purposes, nothing critical! :)

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudwatchLogSubscriptionFilter_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSCloudwatchLogSubscriptionFilter_ -timeout 120m
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_basic
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_basic (54.60s)
=== RUN   TestAccAWSCloudwatchLogSubscriptionFilter_subscriptionFilterDisappears
--- PASS: TestAccAWSCloudwatchLogSubscriptionFilter_subscriptionFilterDisappears (42.12s)

@Ninir Ninir merged commit c244839 into hashicorp:master Jan 25, 2018
Ninir added a commit that referenced this pull request Jan 25, 2018
@bflad
Copy link
Contributor

bflad commented Jan 29, 2018

This has been released in terraform-provider-aws version 1.8.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@bflad bflad added this to the v1.8.0 milestone Jan 29, 2018
@ghost
Copy link

ghost commented Apr 8, 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 Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Distribution in aws_cloudwatch_log_subscription_filter
4 participants