/ workspaces.tf
workspaces.tf
 1  /**
 2   * This is a hacky way of binding specific variable
 3   * values to different Terraform workspaces.
 4   *
 5   * Details:
 6   * https://github.com/hashicorp/terraform/issues/15966
 7   */
 8  
 9  locals {
10    env = {
11      defaults = {
12        /* general */
13        env   = "status"
14        stage = terraform.workspace
15  
16        /* Waku nodes */
17        node_count   = 1
18        node_do_type = "s-1vcpu-2gb"        /* DigitalOcean */
19        node_ac_type = "ecs.t5-lc1m2.small" /* AlibabaCloud */
20        node_gc_type = "g1-small"           /* GoogleCloud  */
21  
22        /* PostgreSQL */
23        db_count     = 1
24        db_do_type   = "s-1vcpu-2gb"        /* DigitalOcean */
25        db_ac_type   = "ecs.t5-lc1m2.small" /* AlibabaCloud */
26        db_gc_type   = "g1-small"           /* GoogleCloud  */
27        db_ac_data_vol_type = "cloud_ssd"
28        db_data_vol_size = 100
29      }
30  
31      # Inherits defaults.
32      test = {}
33      prod = {
34        node_count = 2
35        db_do_type = "s-2vcpu-4gb"
36        db_ac_type = "ecs.sn1ne.large"
37        db_gc_type = "c2d-highcpu-2"
38        db_data_vol_size = 300
39      }
40    }
41  }
42  
43  locals {
44    ws = merge(local.env["defaults"], local.env[terraform.workspace])
45  }