-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add example tf files for custom vpc, sql, redis
- Loading branch information
1 parent
1774635
commit 9825d4d
Showing
9 changed files
with
1,242 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
module "wandb" { | ||
source = "../../" | ||
|
||
namespace = var.namespace | ||
license = var.license | ||
external_dns = true | ||
|
||
deletion_protection = false | ||
create_vpc = var.create_vpc | ||
create_database = var.create_database | ||
database_env = var.database_env | ||
create_elasticache = var.create_elasticache | ||
create_eks = var.create_eks | ||
create_kms = var.create_kms | ||
kms_key_arn = var.kms_key_arn | ||
efs_id = var.efs_id | ||
|
||
network_id = var.vpc_id | ||
network_cidr = var.vpc_cidr | ||
|
||
network_private_subnets = var.network_private_subnets | ||
network_public_subnets = var.network_public_subnets | ||
network_database_subnets = var.network_database_subnets | ||
network_private_subnet_cidrs = var.network_private_subnet_cidrs | ||
network_public_subnet_cidrs = var.network_public_subnet_cidrs | ||
network_database_subnet_cidrs = var.network_database_subnet_cidrs | ||
network_elasticache_subnets = var.network_elasticache_subnets | ||
|
||
|
||
database_instance_class = var.database_instance_class | ||
database_engine_version = var.database_engine_version | ||
database_snapshot_identifier = var.database_snapshot_identifier | ||
database_sort_buffer_size = var.database_sort_buffer_size | ||
|
||
allowed_inbound_cidr = var.allowed_inbound_cidr | ||
allowed_inbound_ipv6_cidr = ["::/0"] | ||
|
||
eks_cluster_version = var.eks_cluster_version | ||
kubernetes_public_access = true | ||
kubernetes_public_access_cidrs = ["0.0.0.0/0"] | ||
|
||
domain_name = var.domain_name | ||
zone_id = var.zone_id | ||
subdomain = var.subdomain | ||
|
||
|
||
bucket_name = var.bucket_name | ||
bucket_kms_key_arn = var.bucket_kms_key_arn | ||
use_internal_queue = true | ||
size = var.size | ||
redis_port = var.redis_port | ||
redis_host = var.redis_host | ||
} | ||
|
||
data "aws_eks_cluster" "app_cluster" { | ||
name = var.create_eks ? module.wandb.cluster_id : var.cluster_name | ||
} | ||
|
||
data "aws_eks_cluster_auth" "app_cluster" { | ||
name = var.create_eks ? module.wandb.cluster_id : var.cluster_name | ||
} | ||
|
||
provider "kubernetes" { | ||
host = data.aws_eks_cluster.app_cluster.endpoint | ||
cluster_ca_certificate = base64decode(data.aws_eks_cluster.app_cluster.certificate_authority[0].data) | ||
token = data.aws_eks_cluster_auth.app_cluster.token | ||
exec { | ||
api_version = "client.authentication.k8s.io/v1beta1" | ||
args = ["eks", "get-token", "--cluster-name", data.aws_eks_cluster.app_cluster.name] | ||
command = "aws" | ||
} | ||
} | ||
provider "helm" { | ||
kubernetes { | ||
host = data.aws_eks_cluster.app_cluster.endpoint | ||
cluster_ca_certificate = base64decode(data.aws_eks_cluster.app_cluster.certificate_authority[0].data) | ||
token = data.aws_eks_cluster_auth.app_cluster.token | ||
exec { | ||
api_version = "client.authentication.k8s.io/v1beta1" | ||
args = ["eks", "get-token", "--cluster-name", data.aws_eks_cluster.app_cluster.name] | ||
command = "aws" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,259 @@ | ||
variable "namespace" { | ||
type = string | ||
description = "Name prefix used for resources" | ||
} | ||
|
||
variable "domain_name" { | ||
type = string | ||
description = "Domain name used to access instance." | ||
} | ||
|
||
variable "zone_id" { | ||
type = string | ||
description = "Id of Route53 zone" | ||
} | ||
|
||
variable "subdomain" { | ||
type = string | ||
default = null | ||
description = "Subdomain for accessing the Weights & Biases UI." | ||
} | ||
|
||
variable "license" { | ||
type = string | ||
} | ||
|
||
variable "database_engine_version" { | ||
description = "Version for MySQL Auora" | ||
type = string | ||
default = "8.0.mysql_aurora.3.03.0" | ||
} | ||
|
||
variable "database_instance_class" { | ||
description = "Instance type to use by database master instance." | ||
type = string | ||
default = "db.r5.large" | ||
} | ||
|
||
variable "database_snapshot_identifier" { | ||
description = "Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a DB cluster snapshot, or the ARN when specifying a DB snapshot" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "database_sort_buffer_size" { | ||
description = "Specifies the sort_buffer_size value to set for the database" | ||
type = number | ||
default = 262144 | ||
} | ||
|
||
variable "wandb_version" { | ||
description = "The version of Weights & Biases local to deploy." | ||
type = string | ||
default = "latest" | ||
} | ||
|
||
variable "kubernetes_instance_types" { | ||
description = "EC2 Instance type for primary node group." | ||
type = list(string) | ||
default = ["m5.large"] | ||
} | ||
|
||
variable "eks_cluster_version" { | ||
description = "EKS cluster kubernetes version" | ||
nullable = false | ||
type = string | ||
} | ||
|
||
variable "wandb_image" { | ||
description = "Docker repository of to pull the wandb image from." | ||
type = string | ||
default = "wandb/local" | ||
} | ||
|
||
variable "bucket_name" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "bucket_kms_key_arn" { | ||
type = string | ||
description = "The Amazon Resource Name of the KMS key with which S3 storage bucket objects will be encrypted." | ||
default = "" | ||
} | ||
|
||
|
||
variable "allowed_inbound_cidr" { | ||
default = ["0.0.0.0/0"] | ||
nullable = false | ||
type = list(string) | ||
} | ||
|
||
|
||
variable "allowed_inbound_ipv6_cidr" { | ||
default = ["::/0"] | ||
nullable = false | ||
type = list(string) | ||
} | ||
|
||
variable "other_wandb_env" { | ||
type = map(string) | ||
description = "Extra environment variables for W&B" | ||
default = {} | ||
} | ||
|
||
variable "enable_operator_alb" { | ||
type = bool | ||
default = false | ||
description = "Boolean indicating whether to use operatore ALB (true) or not (false)." | ||
} | ||
|
||
variable "enable_dummy_dns" { | ||
type = bool | ||
default = false | ||
description = "Boolean indicating whether or not to enable dummy DNS for the old alb" | ||
} | ||
|
||
variable "create_vpc" { | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "vpc_id" { | ||
type = string | ||
description = "VPC network ID" | ||
default = "" | ||
} | ||
|
||
variable "vpc_cidr" { | ||
type = string | ||
description = "VPC network CIDR" | ||
default = "" | ||
} | ||
|
||
variable "network_private_subnets" { | ||
default = [] | ||
description = "A list of the identities of the private subnetworks in which resources will be deployed." | ||
type = list(string) | ||
} | ||
|
||
variable "network_public_subnets" { | ||
default = [] | ||
description = "A list of the identities of the public subnetworks in which resources will be deployed." | ||
type = list(string) | ||
} | ||
|
||
variable "network_database_subnets" { | ||
default = [] | ||
description = "A list of the identities of the database subnetworks in which resources will be deployed." | ||
type = list(string) | ||
} | ||
|
||
variable "network_elasticache_subnets" { | ||
default = [] | ||
description = "A list of the identities of the subnetworks in which elasticache resources will be deployed." | ||
type = list(string) | ||
} | ||
|
||
variable "network_public_subnet_cidrs" { | ||
type = list(string) | ||
description = "List of private subnet CIDR ranges to create in VPC." | ||
default = ["10.10.0.0/24", "10.10.1.0/24"] | ||
} | ||
|
||
variable "network_private_subnet_cidrs" { | ||
type = list(string) | ||
description = "List of private subnet CIDR ranges to create in VPC." | ||
default = ["10.10.10.0/24", "10.10.11.0/24"] | ||
} | ||
|
||
variable "network_database_subnet_cidrs" { | ||
type = list(string) | ||
description = "List of private subnet CIDR ranges to create in VPC." | ||
default = ["10.10.20.0/24", "10.10.21.0/24"] | ||
} | ||
|
||
variable "network_elasticache_subnet_cidrs" { | ||
type = list(string) | ||
description = "List of private subnet CIDR ranges to create in VPC." | ||
default = ["10.10.30.0/24", "10.10.31.0/24"] | ||
} | ||
|
||
variable "private_link_allowed_account_ids" { | ||
description = "List of AWS account IDs allowed to access the VPC Endpoint Service" | ||
type = list(string) | ||
default = [] | ||
} | ||
|
||
|
||
variable "size" { | ||
default = null | ||
description = "Deployment size" | ||
nullable = true | ||
type = string | ||
} | ||
|
||
variable "create_database" { | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "database_env" { | ||
type = object({ | ||
port = string | ||
database_name = string | ||
username = string | ||
password = string | ||
connection_string = string | ||
security_group_id = string | ||
endpoint = string | ||
}) | ||
default = { | ||
port = "3306" | ||
database_name = "wandb_local" | ||
username = "wandb" | ||
password = "" | ||
connection_string = null | ||
security_group_id = "" | ||
endpoint = "" | ||
} | ||
} | ||
|
||
variable "create_elasticache" { | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "create_eks" { | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "efs_id" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "redis_host" { | ||
type = string | ||
default = "" | ||
} | ||
variable "redis_port" { | ||
type = string | ||
default = "6379" | ||
} | ||
|
||
variable "create_kms" { | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "kms_key_arn" { | ||
type = string | ||
default = "" | ||
} |
Oops, something went wrong.