mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 15:51:01 +00:00
added terraform config for aws single node deployment
This commit is contained in:
parent
e769c085ae
commit
39f85fe2a4
4 changed files with 107 additions and 0 deletions
|
|
@ -2,10 +2,12 @@ include:
|
|||
- template: Security/SAST.gitlab-ci.yml
|
||||
- template: Security/License-Scanning.gitlab-ci.yml
|
||||
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
||||
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
- deploy
|
||||
|
||||
install lattice:
|
||||
stage: test
|
||||
|
|
@ -137,3 +139,35 @@ build for darwin arm64:
|
|||
artifacts:
|
||||
paths:
|
||||
- featurebase_darwin_arm64
|
||||
|
||||
init terraform:
|
||||
stage: deploy
|
||||
image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
|
||||
before_script:
|
||||
- cd .terraform
|
||||
script:
|
||||
- gitlab-terraform init
|
||||
|
||||
validate terraform:
|
||||
stage: deploy
|
||||
image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
|
||||
script:
|
||||
- gitlab-terraform validate
|
||||
needs:
|
||||
- job: init terraform
|
||||
|
||||
plan terraform:
|
||||
stage: deploy
|
||||
image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
|
||||
script:
|
||||
- gitlab-terraform plan
|
||||
needs:
|
||||
- job: validate terraform
|
||||
|
||||
apply terraform:
|
||||
stage: deploy
|
||||
image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
|
||||
script:
|
||||
- gitlab-terraform apply
|
||||
needs:
|
||||
- job: plan terraform
|
||||
58
.terraform/main.tf
Normal file
58
.terraform/main.tf
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 3.27"
|
||||
}
|
||||
}
|
||||
|
||||
required_version = ">= 1.0.0"
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
region = "us-east-2"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "server_sg" {
|
||||
name = "Load Balancer Security Group"
|
||||
|
||||
ingress {
|
||||
from_port = 80
|
||||
to_port = 80
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = -1
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
}
|
||||
|
||||
data "cloudinit_config" "server_config" {
|
||||
gzip = true
|
||||
base64_encode = true
|
||||
part {
|
||||
content_type = "text/cloud-config"
|
||||
content = templatefile("${path.module}/server.yml", {
|
||||
header : aws_security_group.server_sg.id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_instance" "server_instance1" {
|
||||
ami = var.ami_linux_amd
|
||||
instance_type = "t2.micro"
|
||||
|
||||
key_name = "souhaila-rsa"
|
||||
|
||||
vpc_security_group_ids = [aws_security_group.server_sg.id]
|
||||
user_data = data.cloudinit_config.server_config.rendered
|
||||
associate_public_ip_address = true
|
||||
|
||||
tags = {
|
||||
Name = var.instance_name
|
||||
}
|
||||
}
|
||||
5
.terraform/server.yml
Normal file
5
.terraform/server.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#cloud-config
|
||||
runcmd:
|
||||
- sudo yum update
|
||||
- sudo yum install postgresql14
|
||||
- sudo yum install golang1.16
|
||||
10
.terraform/variables.tf
Normal file
10
.terraform/variables.tf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
variable "instance_name" {
|
||||
description = "Value of the Name tag for the EC2 instance"
|
||||
type = string
|
||||
default = "single-node-deployment-1"
|
||||
}
|
||||
|
||||
variable "ami_linux_amd" {
|
||||
type = string
|
||||
default = "ami-0f19d220602031aed"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue