@hiiretail/gcp-infra-generators 1.5.0 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generators/common-resources/cloudsql/index.js +4 -1
- package/dist/generators/common-resources/cloudsql/templates/alloydb/instance/spec.hcl +61 -0
- package/dist/generators/common-resources/cloudsql/templates/alloydb/instance/terragrunt.hcl +31 -0
- package/dist/generators/common-resources/cloudsql/templates/alloydb/instance-secrets/terragrunt.hcl +43 -0
- package/dist/generators/common-resources/confluent-cluster/index.js +15 -4
- package/dist/generators/common-resources/confluent-cluster/templates/confluent/spec.hcl +1 -1
- package/dist/node_modules/.package-lock.json +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ module.exports = class extends BaseGenerator {
|
|
|
11
11
|
message: 'Select Cloud SQL database instance type',
|
|
12
12
|
store: true,
|
|
13
13
|
default: 'postgres-clan',
|
|
14
|
-
choices: ['postgres-clan', 'mysql', 'mssql'],
|
|
14
|
+
choices: ['postgres-clan', 'alloydb', 'mysql', 'mssql'],
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
type: 'list',
|
|
@@ -21,6 +21,7 @@ module.exports = class extends BaseGenerator {
|
|
|
21
21
|
default: (response) => {
|
|
22
22
|
const defaultTypes = {
|
|
23
23
|
'postgres-clan': 'POSTGRES_17',
|
|
24
|
+
alloydb: 'POSTGRES_17',
|
|
24
25
|
mysql: 'MYSQL_8_0',
|
|
25
26
|
mssql: 'SQLSERVER_2022_STANDARD',
|
|
26
27
|
};
|
|
@@ -29,6 +30,7 @@ module.exports = class extends BaseGenerator {
|
|
|
29
30
|
choices: (response) => {
|
|
30
31
|
const tierTypes = {
|
|
31
32
|
'postgres-clan': ['POSTGRES_15', 'POSTGRES_16', 'POSTGRES_17'],
|
|
33
|
+
alloydb: ['POSTGRES_17'],
|
|
32
34
|
mysql: ['MYSQL_5_7', 'MYSQL_8_0'],
|
|
33
35
|
mssql: [
|
|
34
36
|
'SQLSERVER_2019_STANDARD',
|
|
@@ -50,6 +52,7 @@ module.exports = class extends BaseGenerator {
|
|
|
50
52
|
message: 'Enter the disk size for the instance, in GB',
|
|
51
53
|
store: true,
|
|
52
54
|
default: 10,
|
|
55
|
+
when: (answers) => answers.instanceType !== 'alloydb',
|
|
53
56
|
},
|
|
54
57
|
{
|
|
55
58
|
type: 'list',
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
locals {
|
|
2
|
+
###################
|
|
3
|
+
# REQUIRED INPUTS #
|
|
4
|
+
###################
|
|
5
|
+
|
|
6
|
+
database_version = "<%- instanceDatabaseVersion %>"
|
|
7
|
+
|
|
8
|
+
location = "europe-west1"
|
|
9
|
+
|
|
10
|
+
# Description: Primary instance configuration for the AlloyDB cluster.
|
|
11
|
+
# Type: Map
|
|
12
|
+
#
|
|
13
|
+
# machine_type options:
|
|
14
|
+
# - "n2-highmem-<machine_cpu_count>" (N2, 3rd Gen Intel x86/Ice Lake)
|
|
15
|
+
# - "c4a-highmem-<machine_cpu_count>-lssd" (C4A, Google Axion ARM, best price/performance)
|
|
16
|
+
# - "c4-highmem-<machine_cpu_count>-lssd" (C4, 6th Gen Intel x86/Granite Rapids)
|
|
17
|
+
#
|
|
18
|
+
# machine_cpu_count must be one of [1, 2, 4, 8, 16, 32, 64, 96, 128] regardless of machine_type.
|
|
19
|
+
# Not all series support all values (e.g., C4(A) starts at 4 vCPUs). Ensure the combination is valid for the selected machine_type.
|
|
20
|
+
#
|
|
21
|
+
# If not specified, the default is "n2-highmem-2" (N2 series, 2 vCPUs).
|
|
22
|
+
primary_instance = {
|
|
23
|
+
instance_id = "primary-instance"
|
|
24
|
+
machine_type = "n2-highmem-2"
|
|
25
|
+
machine_cpu_count = 2
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
###################
|
|
29
|
+
# OPTIONAL INPUTS #
|
|
30
|
+
###################
|
|
31
|
+
|
|
32
|
+
#Description: Enables protection of an AlloyDB cluster from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform).
|
|
33
|
+
#Type: bool
|
|
34
|
+
#Default: true
|
|
35
|
+
deletion_protection = true
|
|
36
|
+
|
|
37
|
+
#Description: Label configurations for the AlloyDB cluster.
|
|
38
|
+
#Type: Map
|
|
39
|
+
#Default: {}
|
|
40
|
+
#cluster_labels = {
|
|
41
|
+
# environment = "environment-name"
|
|
42
|
+
#}
|
|
43
|
+
|
|
44
|
+
#Description: Read pool instances for the AlloyDB cluster.
|
|
45
|
+
#Type: List
|
|
46
|
+
#Default: null
|
|
47
|
+
# read_pool_instance = []
|
|
48
|
+
|
|
49
|
+
#Description: The automated backup policy configuration.
|
|
50
|
+
#Type: Map
|
|
51
|
+
#Default: null
|
|
52
|
+
automated_backup_policy = {
|
|
53
|
+
enabled = <%- enableBackups %>
|
|
54
|
+
location = "europe-west1"
|
|
55
|
+
backup_window = "1800s"
|
|
56
|
+
weekly_schedule = {
|
|
57
|
+
days_of_week = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"]
|
|
58
|
+
start_times = ["2:00:00:00"]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
+
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
+
terraform {
|
|
4
|
+
source = "git::https://github.com/extenda/terraform-google-alloy-db//?ref=v1.0.0"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
# Include all settings from the root terragrunt.hcl file
|
|
8
|
+
include {
|
|
9
|
+
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
locals {
|
|
13
|
+
spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
|
|
14
|
+
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
15
|
+
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
16
|
+
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
17
|
+
component = local.common_vars.locals.component
|
|
18
|
+
product = local.common_vars.locals.product
|
|
19
|
+
tenant-alias = local.common_vars.locals.tenant_alias
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
24
|
+
inputs = merge(
|
|
25
|
+
local.spec_vars.locals,
|
|
26
|
+
{
|
|
27
|
+
cluster_id = "alloydb-cluster-${local.project_vars.locals.project_name}"
|
|
28
|
+
project_id = local.project_vars.locals.project_id
|
|
29
|
+
network_self_link = "projects/${local.project_vars.locals.project_id}/global/networks/${local.project_vars.locals.clan_network}",
|
|
30
|
+
}
|
|
31
|
+
)
|
package/dist/generators/common-resources/cloudsql/templates/alloydb/instance-secrets/terragrunt.hcl
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
|
|
2
|
+
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
|
|
3
|
+
terraform {
|
|
4
|
+
source = "git::https://github.com/extenda/tf-module-gcp-secret-manager//?ref=v0.1.2"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
include {
|
|
8
|
+
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
locals {
|
|
12
|
+
project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
|
|
13
|
+
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
|
|
14
|
+
labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
|
|
15
|
+
component = local.common_vars.locals.component
|
|
16
|
+
product = local.common_vars.locals.product
|
|
17
|
+
tenant-alias = local.common_vars.locals.tenant_alias
|
|
18
|
+
terraform = ""
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dependency "instance" {
|
|
23
|
+
config_path = "../instance"
|
|
24
|
+
mock_outputs = {
|
|
25
|
+
generated_user_password = "dummy-password"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
30
|
+
inputs = merge(
|
|
31
|
+
{
|
|
32
|
+
project_id = local.project_vars.locals.project_id
|
|
33
|
+
secrets = {
|
|
34
|
+
alloydb_primary_instance_id = dependency.instance.outputs.primary_instance_id
|
|
35
|
+
alloydb_primary_instance_ip = dependency.instance.outputs.primary_instance_ip
|
|
36
|
+
alloydb_master_password = dependency.instance.outputs.generated_user_password
|
|
37
|
+
}
|
|
38
|
+
labels = {
|
|
39
|
+
terraform = ""
|
|
40
|
+
cc = local.common_vars.locals.cost_center
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
)
|
|
@@ -6,6 +6,13 @@ const { required } = require('../../../src/validators');
|
|
|
6
6
|
module.exports = class extends BaseGenerator {
|
|
7
7
|
prompting() {
|
|
8
8
|
const prompts = [
|
|
9
|
+
{
|
|
10
|
+
type: 'list',
|
|
11
|
+
name: 'clusterType',
|
|
12
|
+
message: 'What type of Confluent cluster do you want to create?',
|
|
13
|
+
choices: ['basic', 'standard', 'enterprise', 'dedicated'],
|
|
14
|
+
default: 'enterprise',
|
|
15
|
+
},
|
|
9
16
|
{
|
|
10
17
|
type: 'input',
|
|
11
18
|
name: 'clusterName',
|
|
@@ -21,20 +28,24 @@ module.exports = class extends BaseGenerator {
|
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
writing() {
|
|
24
|
-
const { clusterName } = this.answers;
|
|
31
|
+
const { clusterName, clusterType } = this.answers;
|
|
32
|
+
const dirName = `confluent-${clusterType}`;
|
|
25
33
|
|
|
26
34
|
['prod', 'staging'].forEach((env) => {
|
|
27
|
-
this.copyDir('confluent', path.join('infra', env,
|
|
35
|
+
this.copyDir('confluent', path.join('infra', env, dirName), {
|
|
28
36
|
...this.answers,
|
|
29
37
|
env,
|
|
30
38
|
clusterName,
|
|
39
|
+
clusterType,
|
|
31
40
|
});
|
|
32
41
|
});
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
end() {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
45
|
+
const { clusterType } = this.answers;
|
|
46
|
+
const dirName = `confluent-${clusterType}`;
|
|
47
|
+
const specStageFile = path.join('infra', 'staging', dirName);
|
|
48
|
+
const specProdFile = path.join('infra', 'prod', dirName);
|
|
38
49
|
this.log(`
|
|
39
50
|
${chalk.green(`Your Confluent clusters have now been created. To finalize your configuration, please continue
|
|
40
51
|
with manual editing of the generated files.`)}
|
|
@@ -11522,7 +11522,7 @@
|
|
|
11522
11522
|
},
|
|
11523
11523
|
"packages/generators": {
|
|
11524
11524
|
"name": "@hiiretail/gcp-infra-generators",
|
|
11525
|
-
"version": "1.5.
|
|
11525
|
+
"version": "1.5.3",
|
|
11526
11526
|
"license": "MIT",
|
|
11527
11527
|
"dependencies": {
|
|
11528
11528
|
"@google-cloud/storage": "^7.18.0",
|
package/dist/package.json
CHANGED