@hiiretail/gcp-infra-cli 0.65.4 → 0.66.0

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.
@@ -25,12 +25,21 @@ module.exports = class extends BaseGenerator {
25
25
  validate: required,
26
26
  },
27
27
  {
28
+ type: 'list',
29
+ name: 'createTable',
30
+ message: 'Do you want to create a table?',
31
+ default: 'no',
32
+ choices: ['yes', 'no'],
33
+ },
34
+ {
35
+ when: (response) => response.createTable === 'yes',
28
36
  type: 'input',
29
37
  name: 'tableId',
30
38
  message: 'Please provide the ID for the table',
31
39
  validate: required,
32
40
  },
33
41
  {
42
+ when: (response) => response.createTable === 'yes',
34
43
  type: 'input',
35
44
  name: 'expirationTime',
36
45
  message: 'Please provide the time when the table expires (in milliseconds since the epoch). If set to `null`, the table will persist indefinitely.',
@@ -92,6 +101,7 @@ module.exports = class extends BaseGenerator {
92
101
  datasetId,
93
102
  datasetName,
94
103
  description,
104
+ createTable,
95
105
  tableId,
96
106
  expirationTime,
97
107
  createRoutine,
@@ -103,25 +113,49 @@ module.exports = class extends BaseGenerator {
103
113
  } = this.answers;
104
114
 
105
115
  ['prod', 'staging'].forEach((env) => {
106
- this.copyDir(
107
- 'bigquery',
108
- path.join('infra', env, 'bigquery'),
109
- {
110
- ...this.answers,
111
- env,
112
- datasetId,
113
- datasetName,
114
- description,
115
- tableId,
116
- expirationTime,
117
- createRoutine,
118
- routineId,
119
- routineType,
120
- language,
121
- definitionBody,
122
- routineDescription,
123
- },
124
- );
116
+ if (createTable === 'no') {
117
+ this.copyDir(
118
+ 'bigquery',
119
+ path.join('infra', env, 'bigquery', datasetId),
120
+ {
121
+ ...this.answers,
122
+ env,
123
+ datasetId,
124
+ datasetName,
125
+ description,
126
+ createTable,
127
+ createRoutine,
128
+ routineId,
129
+ routineType,
130
+ language,
131
+ definitionBody,
132
+ routineDescription,
133
+ },
134
+ );
135
+ } else {
136
+ ['schema', 'bigquery'].forEach((folder) => {
137
+ this.copyDir(
138
+ folder,
139
+ path.join('infra', env, 'bigquery', datasetId),
140
+ {
141
+ ...this.answers,
142
+ env,
143
+ datasetId,
144
+ datasetName,
145
+ description,
146
+ createTable,
147
+ tableId,
148
+ expirationTime,
149
+ createRoutine,
150
+ routineId,
151
+ routineType,
152
+ language,
153
+ definitionBody,
154
+ routineDescription,
155
+ },
156
+ );
157
+ });
158
+ }
125
159
  });
126
160
  }
127
161
 
@@ -20,7 +20,7 @@ inputs = merge(
20
20
  local.project_vars.locals,
21
21
  {
22
22
  project_id = local.project_vars.locals.project_id
23
- tables = [
23
+ tables = <% if (createTable == 'no') { %>[]<% } else { %>[
24
24
  {
25
25
  table_id = "<%-tableId%>",
26
26
  schema = "./schema.json",
@@ -36,7 +36,7 @@ inputs = merge(
36
36
  labels = {
37
37
  env = "<%-env%>"
38
38
  },
39
- ],
39
+ ]<% } %>
40
40
 
41
41
  routines = <% if (createRoutine == 'no') { %>[]<% } else { %>[
42
42
  {
@@ -1,7 +1,7 @@
1
1
  # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
2
2
  # working directory, into a temporary folder, and execute your Terraform commands in that folder.
3
3
  terraform {
4
- source = "git::https://github.com/extenda/tf-module-gcp-scheduler//?ref=v0.1.1"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-scheduler//?ref=v0.1.3"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -34,7 +34,7 @@ inputs = merge(
34
34
  job_schedule = "<%-schedule%>"
35
35
  <% if (target == 'http') { %>
36
36
  uri = "<%-uri%>"
37
- http_method = "<%-httpMethod%>";
37
+ http_method = "<%-httpMethod%>"
38
38
  <% } else { %>
39
39
  pubsub_topic_name = "projects/${local.project_vars.locals.project_id}/topics/${dependency.topic.outputs.topic}"
40
40
  data = "${base64encode("<%-data%>")}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-cli",
3
- "version": "0.65.4",
3
+ "version": "0.66.0",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {