-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds tagging tests for
drs
. Fixes error when updating
- Loading branch information
Showing
11 changed files
with
2,552 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,874 changes: 1,874 additions & 0 deletions
1,874
internal/service/drs/replication_configuration_template_tags_gen_test.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
internal/service/drs/testdata/ReplicationConfigurationTemplate/tags/main_gen.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
resource "aws_drs_replication_configuration_template" "test" { | ||
associate_default_security_group = false | ||
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 = "t3.small" | ||
replication_servers_security_groups_ids = [aws_security_group.test.id] | ||
staging_area_subnet_id = aws_subnet.test[0].id | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 10 | ||
retention_duration = 60 | ||
units = "MINUTE" | ||
rule_id = 1 | ||
} | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 1 | ||
retention_duration = 24 | ||
units = "HOUR" | ||
rule_id = 2 | ||
} | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 1 | ||
retention_duration = 3 | ||
units = "DAY" | ||
rule_id = 3 | ||
} | ||
|
||
staging_area_tags = { | ||
Name = var.rName | ||
} | ||
|
||
tags = var.resource_tags | ||
} | ||
|
||
resource "aws_security_group" "test" { | ||
name = var.rName | ||
description = var.rName | ||
vpc_id = aws_vpc.test.id | ||
|
||
ingress { | ||
from_port = -1 | ||
to_port = -1 | ||
protocol = "icmp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
} | ||
|
||
# acctest.ConfigVPCWithSubnets(rName, 1) | ||
|
||
resource "aws_vpc" "test" { | ||
cidr_block = "10.0.0.0/16" | ||
|
||
tags = { | ||
Name = var.rName | ||
} | ||
} | ||
|
||
resource "aws_subnet" "test" { | ||
count = 1 | ||
|
||
vpc_id = aws_vpc.test.id | ||
availability_zone = data.aws_availability_zones.available.names[count.index] | ||
cidr_block = cidrsubnet(aws_vpc.test.cidr_block, 8, count.index) | ||
} | ||
|
||
# acctest.ConfigAvailableAZsNoOptInDefaultExclude() | ||
|
||
data "aws_availability_zones" "available" { | ||
exclude_zone_ids = local.default_exclude_zone_ids | ||
state = "available" | ||
|
||
filter { | ||
name = "opt-in-status" | ||
values = ["opt-in-not-required"] | ||
} | ||
} | ||
|
||
locals { | ||
default_exclude_zone_ids = ["usw2-az4", "usgw1-az2"] | ||
} | ||
|
||
variable "rName" { | ||
description = "Name for resource" | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "resource_tags" { | ||
description = "Tags to set on resource. To specify no tags, set to `null`" | ||
# Not setting a default, so that this must explicitly be set to `null` to specify no tags | ||
type = map(string) | ||
nullable = true | ||
} |
109 changes: 109 additions & 0 deletions
109
internal/service/drs/testdata/ReplicationConfigurationTemplate/tagsComputed1/main_gen.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
provider "null" {} | ||
|
||
resource "aws_drs_replication_configuration_template" "test" { | ||
associate_default_security_group = false | ||
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 = "t3.small" | ||
replication_servers_security_groups_ids = [aws_security_group.test.id] | ||
staging_area_subnet_id = aws_subnet.test[0].id | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 10 | ||
retention_duration = 60 | ||
units = "MINUTE" | ||
rule_id = 1 | ||
} | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 1 | ||
retention_duration = 24 | ||
units = "HOUR" | ||
rule_id = 2 | ||
} | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 1 | ||
retention_duration = 3 | ||
units = "DAY" | ||
rule_id = 3 | ||
} | ||
|
||
staging_area_tags = { | ||
Name = var.rName | ||
} | ||
|
||
tags = { | ||
(var.unknownTagKey) = null_resource.test.id | ||
} | ||
} | ||
|
||
resource "aws_security_group" "test" { | ||
name = var.rName | ||
description = var.rName | ||
vpc_id = aws_vpc.test.id | ||
|
||
ingress { | ||
from_port = -1 | ||
to_port = -1 | ||
protocol = "icmp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
} | ||
|
||
# acctest.ConfigVPCWithSubnets(rName, 1) | ||
|
||
resource "aws_vpc" "test" { | ||
cidr_block = "10.0.0.0/16" | ||
|
||
tags = { | ||
Name = var.rName | ||
} | ||
} | ||
|
||
resource "aws_subnet" "test" { | ||
count = 1 | ||
|
||
vpc_id = aws_vpc.test.id | ||
availability_zone = data.aws_availability_zones.available.names[count.index] | ||
cidr_block = cidrsubnet(aws_vpc.test.cidr_block, 8, count.index) | ||
} | ||
|
||
# acctest.ConfigAvailableAZsNoOptInDefaultExclude() | ||
|
||
data "aws_availability_zones" "available" { | ||
exclude_zone_ids = local.default_exclude_zone_ids | ||
state = "available" | ||
|
||
filter { | ||
name = "opt-in-status" | ||
values = ["opt-in-not-required"] | ||
} | ||
} | ||
|
||
locals { | ||
default_exclude_zone_ids = ["usw2-az4", "usgw1-az2"] | ||
} | ||
|
||
resource "null_resource" "test" {} | ||
|
||
variable "rName" { | ||
description = "Name for resource" | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "unknownTagKey" { | ||
type = string | ||
nullable = false | ||
} |
120 changes: 120 additions & 0 deletions
120
internal/service/drs/testdata/ReplicationConfigurationTemplate/tagsComputed2/main_gen.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
provider "null" {} | ||
|
||
resource "aws_drs_replication_configuration_template" "test" { | ||
associate_default_security_group = false | ||
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 = "t3.small" | ||
replication_servers_security_groups_ids = [aws_security_group.test.id] | ||
staging_area_subnet_id = aws_subnet.test[0].id | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 10 | ||
retention_duration = 60 | ||
units = "MINUTE" | ||
rule_id = 1 | ||
} | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 1 | ||
retention_duration = 24 | ||
units = "HOUR" | ||
rule_id = 2 | ||
} | ||
|
||
pit_policy { | ||
enabled = true | ||
interval = 1 | ||
retention_duration = 3 | ||
units = "DAY" | ||
rule_id = 3 | ||
} | ||
|
||
staging_area_tags = { | ||
Name = var.rName | ||
} | ||
|
||
tags = { | ||
(var.unknownTagKey) = null_resource.test.id | ||
(var.knownTagKey) = var.knownTagValue | ||
} | ||
} | ||
|
||
resource "aws_security_group" "test" { | ||
name = var.rName | ||
description = var.rName | ||
vpc_id = aws_vpc.test.id | ||
|
||
ingress { | ||
from_port = -1 | ||
to_port = -1 | ||
protocol = "icmp" | ||
cidr_blocks = ["0.0.0.0/0"] | ||
} | ||
} | ||
|
||
# acctest.ConfigVPCWithSubnets(rName, 1) | ||
|
||
resource "aws_vpc" "test" { | ||
cidr_block = "10.0.0.0/16" | ||
|
||
tags = { | ||
Name = var.rName | ||
} | ||
} | ||
|
||
resource "aws_subnet" "test" { | ||
count = 1 | ||
|
||
vpc_id = aws_vpc.test.id | ||
availability_zone = data.aws_availability_zones.available.names[count.index] | ||
cidr_block = cidrsubnet(aws_vpc.test.cidr_block, 8, count.index) | ||
} | ||
|
||
# acctest.ConfigAvailableAZsNoOptInDefaultExclude() | ||
|
||
data "aws_availability_zones" "available" { | ||
exclude_zone_ids = local.default_exclude_zone_ids | ||
state = "available" | ||
|
||
filter { | ||
name = "opt-in-status" | ||
values = ["opt-in-not-required"] | ||
} | ||
} | ||
|
||
locals { | ||
default_exclude_zone_ids = ["usw2-az4", "usgw1-az2"] | ||
} | ||
|
||
resource "null_resource" "test" {} | ||
|
||
variable "rName" { | ||
description = "Name for resource" | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "unknownTagKey" { | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "knownTagKey" { | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "knownTagValue" { | ||
type = string | ||
nullable = false | ||
} |
Oops, something went wrong.