Created
June 5, 2021 01:48
-
-
Save anthonysnk/0b9e40d692b4bf67b97d23bda4e07115 to your computer and use it in GitHub Desktop.
Main tf lightsail
This file contains hidden or 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
## Creates an AWS Lightsail Instance. | |
resource "aws_lightsail_instance" "lightsail_instance" { | |
name = var.project_name ## Name of lightsail instance in AWS | |
availability_zone = "${var.aws_region}a" ## AZ | |
blueprint_id = var.lightsail_blueprints["wordpress"] ## Options for "wordpress" | |
bundle_id = var.bundle_id ## Options for instance size | |
} | |
## Creates a static public IP address on Lightsail | |
resource "aws_lightsail_static_ip" "static_ip" { | |
name = "${var.project_name}_static_ip" ## Name of static IP in AWS | |
} | |
## Attaches static IP address to Lightsail instance | |
resource "aws_lightsail_static_ip_attachment" "static_ip_attach" { | |
static_ip_name = aws_lightsail_static_ip.static_ip.id | |
instance_name = aws_lightsail_instance.lightsail_instance.id | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment