Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. locals {
  2. ec2_prefix = "sbpvm"
  3. }
  4.  
  5. resource "aws_s3_bucket" "main" {
  6. bucket = "bucket"
  7. acl = "private"
  8.  
  9. tags = {
  10. Name = format("%s-%d", var.bucket_name, 1)
  11. }
  12. }
  13.  
  14. data "aws_ami" "ubuntu" {
  15. most_recent = true
  16.  
  17. filter {
  18. name = "name"
  19. values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
  20. }
  21.  
  22. filter {
  23. name = "virtualization-type"
  24. values = ["hvm"]
  25. }
  26.  
  27. owners = ["099720109477"] # Canonical
  28. }
  29.  
  30. resource "aws_instance" "web" {
  31. count = 3
  32. ami = data.aws_ami.ubuntu.id
  33. instance_type = "t2.micro"
  34.  
  35. tags = {
  36. Name = format("%s-%s", local.ec2_prefix, count.index)
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement