mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
added ouput url
This commit is contained in:
parent
665f4da567
commit
80a1e06e6f
3 changed files with 16 additions and 45 deletions
|
|
@ -1,18 +1,16 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "~> 4.16"
|
||||
}
|
||||
}
|
||||
backend "s3" {
|
||||
bucket = "survey-extractor-terraform-state"
|
||||
region = "eu-north-1"
|
||||
profile = "domna.dev" # /home/vscode/aws/credentials
|
||||
key = "terraform.tfstate"
|
||||
}
|
||||
resource "aws_db_instance" "default" {
|
||||
allocated_storage = var.allocated_storage
|
||||
engine = "postgres"
|
||||
engine_version = "14.10"
|
||||
instance_class = "db.t3.micro"
|
||||
db_name = "surveyDB"
|
||||
username = "postgres"
|
||||
password = "makingwarmhomes"
|
||||
|
||||
required_version = ">= 1.2.0"
|
||||
vpc_security_group_ids = [aws_security_group.rds_sg.id]
|
||||
db_subnet_group_name = aws_db_subnet_group.my_db_subnet_group.name
|
||||
|
||||
skip_final_snapshot = true
|
||||
}
|
||||
|
||||
resource "aws_db_subnet_group" "my_db_subnet_group" {
|
||||
|
|
|
|||
4
deployment/output.tf
Normal file
4
deployment/output.tf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
output "database_uri" {
|
||||
value = "postgresql://${aws_db_instance.default.username}:${aws_db_instance.default.password}@${aws_db_instance.default.endpoint}/${aws_db_instance.default.db_name}"
|
||||
sensitive = true
|
||||
}
|
||||
|
|
@ -14,34 +14,3 @@ terraform {
|
|||
|
||||
required_version = ">= 1.2.0"
|
||||
}
|
||||
|
||||
resource "aws_db_subnet_group" "my_db_subnet_group" {
|
||||
name = "my-db-subnet-group"
|
||||
subnet_ids = [aws_subnet.subnet_a.id, aws_subnet.subnet_b.id]
|
||||
|
||||
tags = {
|
||||
Name = "My DB Subnet Group"
|
||||
}
|
||||
}
|
||||
|
||||
resource aws_db_instance "main" {
|
||||
allocated_storage = var.allocated_storage
|
||||
engine = "postgres"
|
||||
engine_version = "14.10"
|
||||
instance_class = "db.t3.micro"
|
||||
db_name = "surveyDB"
|
||||
username = postgres
|
||||
password = makingwarmhomes
|
||||
|
||||
skip_final_snapshot = true # Needed to delete the db with terraform - otherwise aws will keep a copy
|
||||
|
||||
vpc_security_group_ids = [aws_security_group.rds_sg.id]
|
||||
db_subnet_group_name = aws_db_subnet_group.my_db_subnet_group.name
|
||||
}
|
||||
|
||||
|
||||
|
||||
provider "aws" {
|
||||
profile = var.profile
|
||||
region = var.region
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue