Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ Here is a list of all the examples
| ----------------------------------------- | ----------------------------------------------- |
| Deploy CloudFront + S3 with Terraform | [here](/examples/aws/cdn/cloudfront-s3) |

#### Compute
| Description | Folder |
| ----------------------------------------- | ----------------------------------------------- |
| Deploy AWS EC2 | [here](/examples/aws/compute/ec2) |

### GCP Examples

#### Database
Expand Down
22 changes: 22 additions & 0 deletions examples/aws/compute/ec2/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}

provider "aws" {
region = var.region
}

resource "aws_instance" "ec2" {
ami = var.ami_id
instance_type = var.instance_type

tags = {
Name = var.instance_name
}
}

19 changes: 19 additions & 0 deletions examples/aws/compute/ec2/terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
output "ec2_instance_name" {
description = "Name of EC2 Instance"
value = aws_instance.ec2.tags.Name
}

output "public_ip" {
description = "The public IP address of the EC2 instance."
value = aws_instance.ec2.public_ip
}

output "private_ip" {
description = "The private IP address of the EC2 instance."
value = aws_instance.ec2.private_ip
}

output "public_dns" {
description = "The public DNS name of the EC2 instance."
value = aws_instance.ec2.public_dns
}
24 changes: 24 additions & 0 deletions examples/aws/compute/ec2/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variable "region" {
description = "AWS Region for the EC2 instance."
type = string
default = "eu-central-1" # Replace with your region
}

variable "ami_id" {
description = "AMI ID for the EC2 instance."
type = string
default = "ami-00d2efe5bc0683614" # Replace with a valid AMI ID for your region
}

variable "instance_type" {
description = "Instance type for EC2"
type = string
default = "t2.micro"
}

variable "instance_name" {
description = "Instance Name for EC2"
type = string
default = "qovery_server"
}