Skip to content

Commit

Permalink
tests(examples): fix autoscaling and rds resources
Browse files Browse the repository at this point in the history
  • Loading branch information
diodonfrost committed Jun 4, 2023
1 parent 4e87860 commit fb53728
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
44 changes: 20 additions & 24 deletions examples/autoscaling-scheduler/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ resource "aws_autoscaling_group" "scheduled" {
launch_configuration = aws_launch_configuration.this.name
vpc_zone_identifier = [aws_subnet.this.id]

tags = [
{
key = "tostop"
value = "true"
propagate_at_launch = true
},
{
key = "terratest_tag"
value = var.random_tag
propagate_at_launch = true
},
]
tag {
key = "tostop"
value = "true"
propagate_at_launch = true
}
tag {
key = "terratest_tag"
value = var.random_tag
propagate_at_launch = true
}
}

# Create autoscaling group without tag
Expand All @@ -71,18 +69,16 @@ resource "aws_autoscaling_group" "not_scheduled" {
launch_configuration = aws_launch_configuration.this.name
vpc_zone_identifier = [aws_subnet.this.id]

tags = [
{
key = "tostop"
value = "false"
propagate_at_launch = true
},
{
key = "terratest_tag"
value = var.random_tag
propagate_at_launch = true
},
]
tag {
key = "tostop"
value = "false"
propagate_at_launch = true
}
tag {
key = "terratest_tag"
value = var.random_tag
propagate_at_launch = true
}
}


Expand Down
12 changes: 7 additions & 5 deletions examples/rds-scheduler/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ resource "aws_db_subnet_group" "aurora" {
subnet_ids = [aws_subnet.primary.id, aws_subnet.secondary.id]
}

# Create rds aurora cluster
resource "aws_rds_cluster" "aurora_scheduled" {
cluster_identifier = "aurora-cluster-with-tag"
engine = "aurora-mysql"
db_subnet_group_name = aws_db_subnet_group.aurora.id
database_name = "aurorawithtag"
master_username = "foo"
Expand All @@ -41,9 +41,11 @@ resource "aws_rds_cluster" "aurora_scheduled" {

resource "aws_rds_cluster_instance" "aurora_scheduled" {
identifier = "aurora-cluster-with-tag-writer"
engine = aws_rds_cluster.aurora_scheduled.engine
engine_version = aws_rds_cluster.aurora_scheduled.engine_version
db_subnet_group_name = aws_db_subnet_group.aurora.id
cluster_identifier = aws_rds_cluster.aurora_scheduled.id
instance_class = "db.t2.small"
instance_class = "db.t3.small"

tags = {
tostop = "true"
Expand All @@ -54,7 +56,7 @@ resource "aws_rds_cluster_instance" "aurora_scheduled" {
# Create rds mariadb instance with tag
resource "aws_db_instance" "mariadb_scheduled" {
identifier = "mariadb-instance-with-tag"
name = "mariadbwithtag"
db_name = "mariadbwithtag"
db_subnet_group_name = aws_db_subnet_group.aurora.id
allocated_storage = 10
storage_type = "gp2"
Expand All @@ -74,12 +76,12 @@ resource "aws_db_instance" "mariadb_scheduled" {
# Create rds mysql instance with tag
resource "aws_db_instance" "mysql_not_scheduled" {
identifier = "mysql-instance-without-tag"
name = "mysqlwithouttag"
db_name = "mysqlwithouttag"
db_subnet_group_name = aws_db_subnet_group.aurora.id
allocated_storage = 10
storage_type = "gp2"
engine = "mysql"
engine_version = "5.6"
engine_version = "8.0"
instance_class = "db.t2.micro"
username = "foo"
password = "foobarbaz"
Expand Down

0 comments on commit fb53728

Please sign in to comment.