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

aws_datasync_task accepts a CloudWatch log group but does not enable logging #14666

Closed
tdmalone opened this issue Aug 14, 2020 · 5 comments
Closed
Labels
service/datasync Issues and PRs that pertain to the datasync service.

Comments

@tdmalone
Copy link
Contributor

tdmalone commented Aug 14, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.12.26
+ provider.aws v2.67.0

I'm a little out of date but I have verified from the source that the same issue would exist as the ability to set the LogLevel option doesn't exist and the AWS default is OFF.

Affected Resource(s)

Terraform Configuration Files

resource "aws_datasync_task" "main" {
  name = "my-task"

  source_location_arn      = aws_datasync_location_nfs.source.arn
  destination_location_arn = aws_datasync_location_efs.destination.arn

  cloudwatch_log_group_arn = replace(aws_cloudwatch_log_group.main.arn, "/:\\*$/", "") # NOTE: The :* suffix fix isn't needed beyond v3.0.0
}

resource "aws_cloudwatch_log_group" "main" {
  name = "my-task"
}

Expected Behavior

Datasync task is created with logging enabled to the supplied CloudWatch log group.

Actual Behavior

Datasync task is created, but logging is disabled:

image

The CloudWatch log group ARN is saved, but user must manually enable logging via the CLI (or AWS console) afterwards, eg.:

aws datasync update-task --task-arn arn:aws:datasync:REGION:ACCOUNT:task/task-TASK-ID --options LogLevel=OFF|BASIC|TRANSFER

Steps to Reproduce

  1. terraform apply
  2. Check log settings on created task.

Important Factoids

This is technically a request for supporting the LogLevel option, and could be implemented as follows:

  options {
    # Suggested configuration, not implemented.
    log_level = "BASIC" # Potential values: OFF, BASIC, TRANSFER
  }

I've logged it as a bug rather than a feature as it was unexpected behaviour to be able to provide a cloudwatch_log_group_arn but have logging turned OFF and not be able to be configured via Terraform. Apologies if this should have been a feature instead, I think it could go both ways really!

References

Other aws_datasync_task feature requests:

@ghost ghost added service/cloudwatchlogs service/cloudwatch Issues and PRs that pertain to the cloudwatch service. service/datasync Issues and PRs that pertain to the datasync service. labels Aug 14, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 14, 2020
@tdmalone
Copy link
Contributor Author

Workaround:

resource "aws_datasync_task" "main" {
  ...

  # Sets the task LogLevel: OFF, BASIC or TRANSFER (default is OFF)
  # TODO: Remove this workaround when support is in Terraform, see terraform-providers/terraform-provider-aws#14666
  provisioner "local-exec" {
    command = "aws datasync update-task --task-arn ${self.arn} --options LogLevel=TRANSFER"
  }
}

@edlevin6612
Copy link

Thank you for the workaround, I also had to do something similar for transfer mode:

    # Sets the task TransferMode: ALL or CHANGED (default is CHANGED)
    # TODO: Remove this workaround when support is in Terraform
    provisioner "local-exec" {
        command = "aws datasync update-task --task-arn ${self.arn} --options TransferMode=ALL"
    }

@mattdrees
Copy link

This seems to have been duplicated by #18933 and implemented in #18932. Probably ok to close this issue now.

@tdmalone
Copy link
Contributor Author

Thanks for the heads up @mattdrees! Closing.

@ewbankkit ewbankkit removed needs-triage Waiting for first response or review from a maintainer. service/cloudwatch Issues and PRs that pertain to the cloudwatch service. service/cloudwatchlogs labels May 13, 2021
@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/datasync Issues and PRs that pertain to the datasync service.
Projects
None yet
Development

No branches or pull requests

4 participants