Skip to content

Commit

Permalink
drs: Updates to docs, logic
Browse files Browse the repository at this point in the history
  • Loading branch information
YakDriver committed Jun 18, 2024
1 parent 92e6356 commit 038d967
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 27 deletions.
43 changes: 30 additions & 13 deletions internal/service/drs/replication_configuration_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"testing"

awstypes "github.com/aws/aws-sdk-go-v2/service/drs/types"
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
Expand All @@ -23,7 +24,7 @@ func TestAccDRSReplicationConfigurationTemplate_basic(t *testing.T) {
//if testing.Short() {
// t.Skip("skipping long-running test in short mode")
//}

rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
resourceName := "aws_drs_replication_configuration_template.test"
var rct awstypes.ReplicationConfigurationTemplate

Expand All @@ -36,7 +37,7 @@ func TestAccDRSReplicationConfigurationTemplate_basic(t *testing.T) {
),
Steps: []resource.TestStep{
{
Config: testAccReplicationConfigurationTemplateConfig_basic(),
Config: testAccReplicationConfigurationTemplateConfig_basic(rName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckReplicationConfigurationTemplateExists(ctx, resourceName, &rct),
resource.TestCheckResourceAttrSet(resourceName, names.AttrARN),
Expand Down Expand Up @@ -105,29 +106,45 @@ func testAccCheckReplicationConfigurationTemplateDestroy(ctx context.Context) re
}
}

func testAccReplicationConfigurationTemplateConfig_basic() string {
return `
func testAccReplicationConfigurationTemplateConfig_basic(rName string) string {
return acctest.ConfigCompose(
acctest.ConfigVPCWithSubnets(rName, 1),
fmt.Sprintf(`
resource "aws_security_group" "test" {
name = %[1]q
description = %[1]q
vpc_id = aws_vpc.test.id
ingress {
from_port = -1
to_port = -1
protocol = "icmp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_drs_replication_configuration_template" "test" {
associate_default_security_group = false
bandwidth_throttling = 1
bandwidth_throttling = 12
create_public_ip = false
data_plane_routing = "PRIVATE_IP"
default_large_staging_disk_type = "GP2"
ebs_encryption = "NONE"
use_dedicated_replication_server = false
replication_server_instance_type = "t2.micro"
replication_servers_security_groups_ids = []
staging_area_subnet_id = ""
replication_server_instance_type = "t3.small"
replication_servers_security_groups_ids = [aws_security_group.test.id]
staging_area_subnet_id = aws_subnet.test[0].id
pit_policy {
interval = 1
retention_duration = 1
units = "DAY"
enabled = true
interval = 60
retention_duration = 120
units = "MINUTE"
}
staging_area_tags = {
Name = "staging-area"
Name = %[1]q
}
}
`
`, rName))
}
34 changes: 20 additions & 14 deletions website/docs/r/drs_replication_configuration_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@ Provides an Elastic Disaster Recovery replication configuration template resourc

```terraform
resource "aws_drs_replication_configuration_template" "example" {
associate_default_security_group = True or False
bandwidth_throttling = 123
create_public_ip = True or False
data_plane_routing = "PRIVATE_IP" or "PUBLIC_IP"
default_large_staging_disk_type = "GP2" or "GP3" or "ST1" or "AUTO"
ebs_ecryption = "DEFAULT" or "CUSTOM"
ebs_encryption_key_arn = "string"
pit_policy = [{"enabled": True or False, "interval":123}]
replication_server_instance_type = "string"
replication_servers_security_groups_ids = ["string"]
staging_area_subnet_id = "string"
associate_default_security_group = false
bandwidth_throttling = 12
create_public_ip = false
data_plane_routing = "PRIVATE_IP"
default_large_staging_disk_type = "GP2"
ebs_ecryption = "DEFAULT"
ebs_encryption_key_arn = "arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
replication_server_instance_type = "t3.small"
replication_servers_security_groups_ids = aws_security_group.example[*].id
staging_area_subnet_id = aws_subnet.example.id
use_dedicated_replication_server = false
pit_policy {
enabled = true
interval = 1
retention_duration = 1
units = "DAY"
}
}
```

Expand All @@ -38,9 +44,9 @@ The following arguments are required:
* `associate_default_security_group` - (Required) Whether to associate the default Elastic Disaster Recovery Security group with the Replication Configuration Template.
* `bandwidth_throttling` - (Required) Configure bandwidth throttling for the outbound data transfer rate of the Source Server in Mbps.
* `create_public_ip` - (Required) Whether to create a Public IP for the Recovery Instance by default.
* `data_plane_routing` - (Required) Data plane routing mechanism that will be used for replication.
* `default_large_staging_disk_type` - (Required) Staging Disk EBS volume type to be used during replication.
* `ebs_encryption` - (Required) Type of EBS encryption to be used during replication.
* `data_plane_routing` - (Required) Data plane routing mechanism that will be used for replication. Valid values are `PUBLIC_IP` and `PRIVATE_IP`.
* `default_large_staging_disk_type` - (Required) Staging Disk EBS volume type to be used during replication. Valid values are `GP2`, `GP3`, `ST1`, or `AUTO`.
* `ebs_encryption` - (Required) Type of EBS encryption to be used during replication. Valid values are `DEFAULT` and `CUSTOM`.
* `ebs_encryption_key_arn` - (Required) ARN of the EBS encryption key to be used during replication.
* `pit_policy` - (Required) Configuration block for Point in time (PIT) policy to manage snapshots taken during replication. [See below](#pit_policy).
* `replication_server_instance_type` - (Required) Instance type to be used for the replication server.
Expand Down

0 comments on commit 038d967

Please sign in to comment.