Resource: aws_datasync_task

Manages an AWS DataSync Task, which represents a configuration for synchronization. Starting an execution of these DataSync Tasks (actually synchronizing files) is performed outside of this Terraform resource.

Example Usage

resource "aws_datasync_task" "example" {
  destination_location_arn = aws_datasync_location_s3.destination.arn
  name                     = "example"
  source_location_arn      = aws_datasync_location_nfs.source.arn

  options {
    bytes_per_second = -1
  }
}

Example Usage with Scheduling

resource "aws_datasync_task" "example" {
  destination_location_arn = aws_datasync_location_s3.destination.arn
  name                     = "example"
  source_location_arn      = aws_datasync_location_nfs.source.arn

  schedule {
    schedule_expression = "cron(0 12 ? * SUN,WED *)"
  }
}

Example Usage with Filtering

resource "aws_datasync_task" "example" {
  destination_location_arn = aws_datasync_location_s3.destination.arn
  name                     = "example"
  source_location_arn      = aws_datasync_location_nfs.source.arn

  excludes {
    filter_type = "SIMPLE_PATTERN"
    value       = "/folder1|/folder2"
  }

  includes {
    filter_type = "SIMPLE_PATTERN"
    value       = "/folder1|/folder2"
  }
}

Argument Reference

This resource supports the following arguments:

options Argument Reference

The options configuration block supports the following arguments:

task_report_config Argument Reference

The following arguments are supported inside the task_report_config configuration block:

s3_destination Argument Reference

The following arguments are supported inside the s3_destination configuration block:

report_overrides Argument Reference

The following arguments are supported inside the report_overrides configuration block:

Schedule

excludes Argument Reference

includes Argument Reference

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import aws_datasync_task using the DataSync Task Amazon Resource Name (ARN). For example:

import {
  to = aws_datasync_task.example
  id = "arn:aws:datasync:us-east-1:123456789012:task/task-12345678901234567"
}

Using terraform import, import aws_datasync_task using the DataSync Task Amazon Resource Name (ARN). For example:

% terraform import aws_datasync_task.example arn:aws:datasync:us-east-1:123456789012:task/task-12345678901234567