main.tf 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. provider "aws" {
  2. region = var.region
  3. profile = var.profile
  4. }
  5. module "vpc" {
  6. source = "../tfmodule-aws-2tier-vpc"
  7. region = var.region
  8. profile = var.profile
  9. vpc-name = var.vpc-name
  10. vpc-cidr = var.vpc-cidr
  11. vpc-azs = var.vpc-azs
  12. enable-private = false
  13. common-tags = {
  14. "Owner" = "maguec"
  15. "Project" = "example_terraform"
  16. }
  17. }
  18. module "nodes" {
  19. source = "../tfmodule-aws-redis-enterprise"
  20. region = var.region
  21. profile = var.profile
  22. open-nets = ["76.14.80.208/32"]
  23. data-node-count = 3
  24. vpc-cidr = var.vpc-cidr
  25. vpc-azs = var.vpc-azs
  26. vpc-name = var.vpc-name
  27. vpc-id = module.vpc.vpc-id
  28. vpc-subnets = module.vpc.subnets-public
  29. common-tags = {
  30. "Owner" = "maguec"
  31. "Project" = "example_terraform"
  32. }
  33. }
  34. output "node-ips" {
  35. value = <<EOT
  36. %{ for ip in module.nodes.node-ips ~}
  37. ssh -i ~/.ssh/${var.vpc-name}.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${ip}
  38. %{ endfor ~}
  39. EOT
  40. }