mirror of
https://github.com/sidpalas/devops-directive-terraform-course.git
synced 2025-12-15 07:11:14 +00:00
add modules 5-9
This commit is contained in:
35
08-testing/examples/hello-world/main.tf
Normal file
35
08-testing/examples/hello-world/main.tf
Normal file
@@ -0,0 +1,35 @@
|
||||
terraform {
|
||||
# Assumes s3 bucket and dynamo DB table already set up
|
||||
# See /code/03-basics/aws-backend
|
||||
backend "s3" {
|
||||
bucket = "devops-directive-tf-state"
|
||||
key = "08-testing/examples/hello-world/terraform.tfstate"
|
||||
region = "us-east-1"
|
||||
dynamodb_table = "terraform-state-locking"
|
||||
encrypt = true
|
||||
}
|
||||
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
region = "us-east-1"
|
||||
}
|
||||
|
||||
|
||||
module "web_app" {
|
||||
source = "../../modules/hello-world"
|
||||
}
|
||||
|
||||
output "instance_ip_addr" {
|
||||
value = module.web_app.instance_ip_addr
|
||||
}
|
||||
|
||||
output "url" {
|
||||
value = "http://${module.web_app.instance_ip_addr}:8080"
|
||||
}
|
||||
Reference in New Issue
Block a user