creamy-quill-48140
03/09/2023, 1:29 AMvictorious-lawyer-58417
03/10/2023, 12:31 AMcreamy-quill-48140
03/10/2023, 12:59 AMhallowed-glass-14538
03/10/2023, 1:20 AM# Random suffix for this deployment
resource "random_string" "suffix" {
length = 8
special = false
upper = false
}
locals {
resource_prefix = "metaflow"
resource_suffix = random_string.suffix.result
subnet_ids = [for x,y in data.aws_subnet_ids.pre_created_public_subnet_ids.ids : y]
}
variable "with_public_ip" { # TODO : ADD PUBLIC IP PREFERENCE HERE
default = true
}
variable "vpc_id" {} # TODO : ADD YOUR VPC ID HERE
data "aws_vpc" "pre_created_vpc" {
id = var.vpc_id
}
data "aws_subnet_ids" "pre_created_public_subnet_ids" {
vpc_id = var.vpc_id
filter {
name = "map-public-ip-on-launch"
values = ["true"]
}
}
module "metaflow" {
source = "outerbounds/metaflow/aws"
version = "0.9.2"
resource_prefix = local.resource_prefix
resource_suffix = local.resource_suffix
enable_step_functions = false
subnet1_id = local.subnet_ids[0]
subnet2_id = local.subnet_ids[1]
vpc_cidr_blocks = data.aws_vpc.pre_created_vpc.cidr_block_associations.*.cidr_block
vpc_id = var.vpc_id
with_public_ip = var.with_public_ip
tags = {
"managedBy" = "terraform"
}
}
# The module will generate a Metaflow config in JSON format, write it to a file
resource "local_file" "metaflow_config" {
content = module.metaflow.metaflow_profile_json
filename = "./metaflow_profile.json"
}creamy-quill-48140
03/10/2023, 12:44 PM