完成イメージ は以下の通りです。
tfファイルの内容は以下の通りです。
resource "aws_elasticache_subnet_group" "grp" {
name = "redis-example"
subnet_ids = ["${var.subnet_id_public_a}", "${var.subnet_id_public_c}", "${var.subnet_id_public_d}"]
}
resource "aws_elasticache_replication_group" "replica_grp" {
automatic_failover_enabled = true
availability_zones = ["ap-northeast-1d", "ap-northeast-1c", "ap-northeast-1a"]
replication_group_id = "example-redis"
replication_group_description = "This is a example for create redis by terraform."
node_type = "cache.t2.small"
snapshot_retention_limit = 5
number_cache_clusters = 3
port = 6379
subnet_group_name = "${aws_elasticache_subnet_group.grp.name}"
security_group_ids = ["${var.default_security_group_id}"]
}
name = "redis-example"
subnet_ids = ["${var.subnet_id_public_a}", "${var.subnet_id_public_c}", "${var.subnet_id_public_d}"]
}
resource "aws_elasticache_replication_group" "replica_grp" {
automatic_failover_enabled = true
availability_zones = ["ap-northeast-1d", "ap-northeast-1c", "ap-northeast-1a"]
replication_group_id = "example-redis"
replication_group_description = "This is a example for create redis by terraform."
node_type = "cache.t2.small"
snapshot_retention_limit = 5
number_cache_clusters = 3
port = 6379
subnet_group_name = "${aws_elasticache_subnet_group.grp.name}"
security_group_ids = ["${var.default_security_group_id}"]
}
availability_zones :3つのゾーンを入力します。
snapshot_retention_limit:バックアップの保存期間になります
0 件のコメント:
コメントを投稿