/ 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        /* Default settings for all fleets/workspaces. */
13  
14        boot_hosts_count = 1
15        store_hosts_count = 2
16        store_db_hosts_count = 1
17        store_db_data_vol_size = 100
18  
19        store_do_type = "s-1vcpu-2gb"        /* DigitalOcean */
20        store_ac_type = "ecs.t5-lc1m2.small" /* Alibaba Cloud */
21        store_gc_type = "g1-small"           /* Google Cloud */
22  
23        boot_do_type = "s-1vcpu-2gb"        /* DigitalOcean */
24        boot_ac_type = "ecs.t5-lc1m2.small" /* Alibaba Cloud */
25        boot_gc_type = "g1-small"           /* Google Cloud */
26  
27        db_do_type = "s-1vcpu-2gb"          /* DigitalOcean */
28        db_ac_type = "ecs.t5-lc1m2.small"   /* Alibaba Cloud */
29        db_gc_type = "g1-small"             /* Google Cloud */
30      }
31  
32      /* Settings specific to the test fleet/workspace. */
33      prod = {
34        store_do_type = "s-4vcpu-8gb"
35        store_ac_type = "ecs.t5-lc1m4.large"
36        store_gc_type = "c2d-standard-4"
37  
38        boot_do_type = "s-2vcpu-4gb"
39        boot_ac_type = "ecs.t5-lc1m2.large"
40        boot_gc_type = "c2d-standard-2"
41  
42        db_do_type = "c2-16vcpu-32gb-intel"
43        db_ac_type = "ecs.c6.4xlarge"
44        db_gc_type = "c2d-highcpu-16"
45  
46        store_db_data_vol_size = 320
47      }
48      staging = {
49        store_do_type = "s-2vcpu-4gb"
50        store_ac_type = "ecs.t5-lc1m2.large"
51        store_gc_type = "c2d-highcpu-2"
52  
53        boot_do_type = "s-2vcpu-4gb"
54        boot_ac_type = "ecs.t5-lc1m2.large"
55        boot_gc_type = "c2d-highcpu-2"
56  
57        db_do_type = "s-2vcpu-4gb"
58        db_ac_type = "ecs.t5-lc1m2.large"
59        db_gc_type = "c2d-highcpu-2"
60      }
61    }
62  }
63  
64  /* Makes fleet settings available under local.ws. */
65  locals {
66    ws = merge(local.env["defaults"], local.env[terraform.workspace])
67  }