Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Terraform code to dedicated directory and add main.tf in it #6

Merged
merged 3 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# Ignore Terraform plan file
tfplan

# Ignore Terraform vars files to avoid leaking information
terraform.tfvars

# Ignore other files
id_rsa*
hosts
Expand Down
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
# DAOS on GCP
# Distributed Asynchronous Object Storage (DAOS) on Google Cloud Platform (GCP)

Scripts to deploy DAOS on Google Cloud.
This repository contains scripts to deploy DAOS on GCP.

This module is a collection of terraform submodules to deploy DAOS client and server instances on GCP.
Below is the list of available submodules:

* [DAOS Server](modules/daos_server)
* [DAOS Client](modules/daos_client)

## Compatibility

This moduel is meant to use with Terraform 0.14.

## Examples

Examples of how to use these modules can be found in the [examples](examples) folder.
It consists of the directories:
- [images](images) - which contains scripts to prepare DAOS images for GCP used by Terraform code
- [terraform](terraform) - which contains Terraform code used to deploy DAOS on GCP
19 changes: 19 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Terraform deployment of Distributed Asynchronous Object Storage (DAOS) on Google Cloud Platform (GCP)

This directory contains Terraform code to deploy DAOS on GCP.

This module consists of a collection of Terraform submodules to deploy DAOS client and server instances on GCP.
Below is the list of available submodules:

* [DAOS Server](modules/daos_server)
* [DAOS Client](modules/daos_client)

To deploy full DAOS cluster use [full_cluster_setup](examples/full_cluster_setup) example.

## Compatibility

This module is meant to use with Terraform 0.14.

## Examples

[examples](examples) directory contains Terraform code of how to use these particular submodules.
21 changes: 21 additions & 0 deletions terraform/examples/full_cluster_setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Full DAOS cluster setup

Deploys full DAOS cluster with servers and clients.

## Usage

1. Create ```terraform.tfvars``` in this directory or the directory where you're running this example.
2. Copy the ```terraform.tfvars.example``` content into ```terraform.tfvars``` file and update the contents to match your environment.
3. Run below commands to deploy DAOS cluster:

```
terraform init -input=false
terraform plan -out=tfplan -input=false
terraform apply -input=false tfplan
```

To destroy DAOS environment, use below command:

```
terraform destroy -auto-approve
```
48 changes: 48 additions & 0 deletions terraform/examples/full_cluster_setup/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
provider "google" {
region = var.region
}

module "daos_server" {
source = "../../modules/daos_server"
project_id = var.project_id
network = var.network
subnetwork = var.subnetwork
subnetwork_project = var.subnetwork_project
region = var.region
zone = var.zone

number_of_instances = var.server_number_of_instances
daos_disk_count = var.server_daos_disk_count

instance_base_name = var.server_instance_base_name
os_disk_size_gb = var.server_os_disk_size_gb
os_disk_type = var.server_os_disk_type
template_name = var.server_template_name
mig_name = var.server_mig_name
machine_type = var.server_machine_type
os_project = var.server_os_project
os_family = var.server_os_family
preemptible = var.preemptible
}

module "daos_client" {
source = "../../modules/daos_client"
project_id = var.project_id
network = var.network
subnetwork = var.subnetwork
subnetwork_project = var.subnetwork_project
region = var.region
zone = var.zone

number_of_instances = var.client_number_of_instances

instance_base_name = var.client_instance_base_name
os_disk_size_gb = var.client_os_disk_size_gb
os_disk_type = var.client_os_disk_type
template_name = var.client_template_name
mig_name = var.client_mig_name
machine_type = var.client_machine_type
os_project = var.client_os_project
os_family = var.client_os_family
preemptible = var.preemptible
}
28 changes: 28 additions & 0 deletions terraform/examples/full_cluster_setup/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project_id = ""
network = "default"
subnetwork = "default"
subnetwork_project = ""
region = "us-central1"
zone = "us-central1-a"
preemptible = "false"
# Server
server_number_of_instances = 1
server_daos_disk_count = 8
server_instance_base_name = "daos-server"
server_os_disk_size_gb = 20
server_os_disk_type = "pd-ssd"
server_template_name = "daos-server"
server_mig_name = "daos-server"
server_machine_type = "n2-highmem-32"
server_os_project = ""
server_os_family = "daos-server"
# Client
client_number_of_instances = 1
client_instance_base_name = "daos-client"
client_os_disk_size_gb = 20
client_os_disk_type = "pd-ssd"
client_template_name = "daos-client"
client_mig_name = "daos-client"
client_machine_type = "c2-standard-16"
client_os_project = ""
client_os_family = "daos-client"
169 changes: 169 additions & 0 deletions terraform/examples/full_cluster_setup/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
variable "project_id" {
description = "The GCP project to use "
type = string
default = null
}
variable "region" {
description = "The GCP region to create and test resources in"
type = string
default = null
}
variable "zone" {
description = "The GCP zone to create and test resources in"
type = string
default = null
}

variable "server_os_family" {
description = "OS GCP image family"
default = null
type = string
}

variable "client_os_family" {
description = "OS GCP image family"
default = null
type = string
}

variable "server_os_project" {
description = "OS GCP image project name"
default = null
type = string
}

variable "client_os_project" {
description = "OS GCP image project name"
default = null
type = string
}

variable "server_os_disk_size_gb" {
description = "OS disk size in GB"
default = 20
type = number
}

variable "client_os_disk_size_gb" {
description = "OS disk size in GB"
default = 20
type = number
}

variable "server_os_disk_type" {
description = "OS disk type e.g. pd-ssd, pd-standard"
default = "pd-ssd"
type = string
}

variable "client_os_disk_type" {
description = "OS disk type e.g. pd-ssd, pd-standard"
default = "pd-ssd"
type = string
}

variable "server_template_name" {
description = "MIG template name"
default = null
type = string
}

variable "client_template_name" {
description = "MIG template name"
default = null
type = string
}

variable "server_mig_name" {
description = "MIG name "
default = null
type = string
}

variable "client_mig_name" {
description = "MIG name "
default = null
type = string
}

variable "server_machine_type" {
description = "GCP machine type. e.g. e2-medium"
default = null
type = string
}

variable "client_machine_type" {
description = "GCP machine type. e.g. e2-medium"
default = null
type = string
}

variable "network" {
description = "GCP network to use"
default = null
type = string
}

variable "subnetwork" {
description = "GCP sub-network to use"
default = null
type = string
}

variable "subnetwork_project" {
description = "The GCP project where the subnetwork is defined"
type = string
default = null
}

variable "server_instance_base_name" {
description = "MIG instance base names to use"
default = null
type = string
}

variable "client_instance_base_name" {
description = "MIG instance base names to use"
default = null
type = string
}

variable "server_number_of_instances" {
description = "Number of daos servers to bring up"
default = null
type = number
}

variable "client_number_of_instances" {
description = "Number of daos servers to bring up"
default = null
type = number
}

variable "daos_disk_type" {
description = "Daos disk type to use. For now only suported one is local-ssd"
default = "local-ssd"
type = string
}

variable "server_daos_disk_count" {
description = "Number of local ssd's to use"
default = null
type = number
}

variable "daos_service_account_scopes" {
description = "Scopes for the DAOS server service account"
default = [
"userinfo-email",
"compute-ro",
"storage-ro"
]
type = list(string)
}

variable "preemptible" {
description = "If preemptible instances"
default = true
type = string
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.