Skip to content

Commit

Permalink
Merge pull request #83 from cloud-barista/feature/Add-operate-service
Browse files Browse the repository at this point in the history
Feature/add operate service
  • Loading branch information
heedaeshin authored Oct 31, 2024
2 parents 6961c6f + b71bb03 commit da7a049
Show file tree
Hide file tree
Showing 44 changed files with 1,630 additions and 18 deletions.
36 changes: 35 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,38 @@ go.work
mc-data-manager

# Credential
profile.json
profile.json
secrets.json
gcp.json
*.tfvars



# Local .terraform directories
.terraform/
.terraform*
terraform.tfstate
terraform.tfstate.*
crash.log
crash.*
*.tfvars
*.tfstate
*.tfstate.*

# Sensitive variable definition files
secrets.tfvars
terraform.tfvars
*.auto.tfvars

# Ignore override files as they are usually machine-specific
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore CLI configuration files
.terraformrc
terraform.rc

# Ignore plan output files
*.tfplan
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ ARG GID=0
ARG USER=root
ARG GROUP=root
#-------------------------------------------------------------
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get upgrade
RUN apt-get install -y ca-certificates curl jq gnupg software-properties-common wget lsb-release && rm -rf /var/lib/apt/lists/*

#-------------------------------------------------------------
# Add the HashiCorp GPG key and official repository for Terraform
RUN wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | tee /usr/share/keyrings/hashicorp-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list && \
apt update && apt install -y terraform && \
rm -rf /var/lib/apt/lists/*
#-------------------------------------------------------------
# User Set
RUN if [ "${USER}" != "root" ]; then \
Expand Down
70 changes: 70 additions & 0 deletions data/var/run/data-manager/template/example/AWS/BUILDER/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# main.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.73.0"
}
}
}

# AWS Provider set
provider "aws" {
region = var.region
access_key = var.access_key
secret_key = var.secret_key

}

resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}

resource "aws_subnet" "main" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
availability_zone = var.zone
}


resource "aws_security_group" "allow_all" {
name = "allow_all_traffic"
description = "Allow all inbound and outbound traffic"
vpc_id = aws_vpc.main.id

ingress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}



# S3 module call
module "s3" {
source = "./modules/storage"
bucket_name = var.bucket_name
}

# mysql module call
module "mysql" {
source = "./modules/mysql"
db_name = var.db_name
db_user = var.db_user
db_pswd = var.db_pswd
}

# DynamoDB module call
module "dynamodb" {
source = "./modules/dynamodb"
table_name = var.table_name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "aws_dynamodb_table" "dynamodb_table" {
name = var.table_name
read_capacity = 1
write_capacity = 1
hash_key = "UserId"

attribute {
name = "UserId"
type = "S"
}
deletion_protection_enabled = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# variables.tf

# variable "access_key" {
# description = "AWS Access Key"
# type = string
# }

# variable "secret_key" {
# description = "AWS Secret Key"
# type = string
# }

# variable "region" {
# description = "AWS Region"
# type = string
# default = "KR"
# }

# variable "vpc_name" {
# description = "vpc_name"
# type = string
# default = "mcmp-vpc"

# }

# variable "private_subnet_name" {
# description = "private_subnet_name"
# type = string

# }
# variable "public_subnet_name" {
# description = "public_subnet_name"
# type = string

# }

variable "table_name" {
description = "table_name"
type = string
}

# variable "db_name" {
# description = "DB name"
# type = string
# }


# variable "db_user" {
# description = "DB user"
# type = string
# }

# variable "db_pswd" {
# description = "DB PW"
# type = string
# }




Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@



resource "aws_db_instance" "default" {
allocated_storage = 10
db_name = var.db_name
engine = "mysql"
engine_version = "8.0"
instance_class = "db.t3.micro"
username = var.db_user
password = var.db_pswd
parameter_group_name = "default.mysql8.0"
skip_final_snapshot = true
deletion_protection = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# variables.tf

# variable "access_key" {
# description = "AWS Access Key"
# type = string
# }

# variable "secret_key" {
# description = "AWS Secret Key"
# type = string
# }

# variable "region" {
# description = "AWS Region"
# type = string
# default = "KR"
# }

# variable "vpc_name" {
# description = "vpc_name"
# type = string
# default = "mcmp-vpc"

# }

# variable "private_subnet_name" {
# description = "private_subnet_name"
# type = string

# }
# variable "public_subnet_name" {
# description = "public_subnet_name"
# type = string

# }

# variable "bucket_name" {
# description = "bucket_name"
# type = string
# }

variable "db_name" {
description = "DB name"
type = string
}


variable "db_user" {
description = "DB user"
type = string
}

variable "db_pswd" {
description = "DB PW"
type = string
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


resource "aws_s3_bucket" "bucket" {
bucket = var.bucket_name

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# variables.tf

# variable "access_key" {
# description = "AWS Access Key"
# type = string
# }

# variable "secret_key" {
# description = "AWS Secret Key"
# type = string
# }

# variable "region" {
# description = "AWS Region"
# type = string
# default = "KR"
# }

# variable "vpc_name" {
# description = "vpc_name"
# type = string
# default = "mcmp-vpc"

# }

# variable "private_subnet_name" {
# description = "private_subnet_name"
# type = string

# }
# variable "public_subnet_name" {
# description = "public_subnet_name"
# type = string

# }

variable "bucket_name" {
description = "bucket_name"
type = string
}

# variable "db_name" {
# description = "DB name"
# type = string
# }


# variable "db_user" {
# description = "DB user"
# type = string
# }

# variable "db_pswd" {
# description = "DB PW"
# type = string
# }




Loading

0 comments on commit da7a049

Please sign in to comment.