From ef1da57c4f7a83c660e8f7faf573f8a5c2f8f88d Mon Sep 17 00:00:00 2001 From: Daniel Barnes Date: Fri, 5 Aug 2022 08:36:27 -0700 Subject: [PATCH 1/4] print json for debug --- src/terraform.js | 74 +++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/src/terraform.js b/src/terraform.js index 37dd856ac..f0a60062d 100644 --- a/src/terraform.js +++ b/src/terraform.js @@ -77,43 +77,47 @@ const iterativeProviderTpl = ({ tpiVersion }) => ({ } }); -const iterativeCmlRunnerTpl = (opts = {}) => ({ - ...iterativeProviderTpl(opts), - resource: { - iterative_cml_runner: { - runner: { - ...(opts.awsSecurityGroup && { - aws_security_group: opts.awsSecurityGroup - }), - ...(opts.awsSubnet && { aws_subnet: opts.awsSubnet }), - ...(opts.cloud && { cloud: opts.cloud }), - ...(opts.cmlVersion && { cml_version: opts.cmlVersion }), - ...(opts.dockerVolumes && { docker_volumes: opts.dockerVolumes }), - ...(opts.driver && { driver: opts.driver }), - ...(opts.gpu && { instance_gpu: opts.gpu }), - ...(opts.hddSize && { instance_hdd_size: opts.hddSize }), - ...(typeof opts.idleTimeout !== 'undefined' && { - idle_timeout: opts.idleTimeout - }), - ...(opts.labels && { labels: opts.labels }), - ...(opts.metadata && { metadata: opts.metadata }), - ...(opts.name && { name: opts.name }), - ...(opts.permissionSet && { - instance_permission_set: opts.permissionSet - }), - ...(opts.region && { region: opts.region }), - ...(opts.repo && { repo: opts.repo }), - ...(opts.single && { single: opts.single }), - ...(opts.spot && { spot: opts.spot }), - ...(opts.spotPrice && { spot_price: opts.spotPrice }), - ...(opts.sshPrivate && { ssh_private: opts.sshPrivate }), - ...(opts.startupScript && { startup_script: opts.startupScript }), - ...(opts.token && { token: opts.token }), - ...(opts.type && { instance_type: opts.type }) +const iterativeCmlRunnerTpl = (opts = {}) => { + var obj = { + ...iterativeProviderTpl(opts), + resource: { + iterative_cml_runner: { + runner: { + ...(opts.awsSecurityGroup && { + aws_security_group: opts.awsSecurityGroup + }), + ...(opts.awsSubnet && { aws_subnet: opts.awsSubnet }), + ...(opts.cloud && { cloud: opts.cloud }), + ...(opts.cmlVersion && { cml_version: opts.cmlVersion }), + ...(opts.dockerVolumes && { docker_volumes: opts.dockerVolumes }), + ...(opts.driver && { driver: opts.driver }), + ...(opts.gpu && { instance_gpu: opts.gpu }), + ...(opts.hddSize && { instance_hdd_size: opts.hddSize }), + ...(typeof opts.idleTimeout !== 'undefined' && { + idle_timeout: opts.idleTimeout + }), + ...(opts.labels && { labels: opts.labels }), + ...(opts.metadata && { metadata: opts.metadata }), + ...(opts.name && { name: opts.name }), + ...(opts.permissionSet && { + instance_permission_set: opts.permissionSet + }), + ...(opts.region && { region: opts.region }), + ...(opts.repo && { repo: opts.repo }), + ...(opts.single && { single: opts.single }), + ...(opts.spot && { spot: opts.spot }), + ...(opts.spotPrice && { spot_price: opts.spotPrice }), + ...(opts.sshPrivate && { ssh_private: opts.sshPrivate }), + ...(opts.startupScript && { startup_script: opts.startupScript }), + ...(opts.token && { token: opts.token }), + ...(opts.type && { instance_type: opts.type }) + } } } - } -}); + }; + console.log(JSON.stringify(obj)); + return obj; +}; const checkMinVersion = async () => { const ver = await version(); From a9cf9a2134bf15f8e6c9b74f9ba3aadab4936733 Mon Sep 17 00:00:00 2001 From: Daniel Barnes Date: Fri, 5 Aug 2022 09:18:05 -0700 Subject: [PATCH 2/4] fix aws_subnet ref --- src/terraform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/terraform.js b/src/terraform.js index f0a60062d..4ae5413cc 100644 --- a/src/terraform.js +++ b/src/terraform.js @@ -86,7 +86,7 @@ const iterativeCmlRunnerTpl = (opts = {}) => { ...(opts.awsSecurityGroup && { aws_security_group: opts.awsSecurityGroup }), - ...(opts.awsSubnet && { aws_subnet: opts.awsSubnet }), + ...(opts.awsSubnet && { aws_subnet_id: opts.awsSubnet }), ...(opts.cloud && { cloud: opts.cloud }), ...(opts.cmlVersion && { cml_version: opts.cmlVersion }), ...(opts.dockerVolumes && { docker_volumes: opts.dockerVolumes }), From 5eedb9781aa257c1910fbadae36f9dd1574af91a Mon Sep 17 00:00:00 2001 From: Daniel Barnes Date: Fri, 5 Aug 2022 09:24:07 -0700 Subject: [PATCH 3/4] remove debugging --- src/terraform.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/terraform.js b/src/terraform.js index 4ae5413cc..bdfd17835 100644 --- a/src/terraform.js +++ b/src/terraform.js @@ -78,7 +78,7 @@ const iterativeProviderTpl = ({ tpiVersion }) => ({ }); const iterativeCmlRunnerTpl = (opts = {}) => { - var obj = { + const tfObj = { ...iterativeProviderTpl(opts), resource: { iterative_cml_runner: { @@ -115,8 +115,7 @@ const iterativeCmlRunnerTpl = (opts = {}) => { } } }; - console.log(JSON.stringify(obj)); - return obj; + return tfObj; }; const checkMinVersion = async () => { From 451e63d4bcc96e6f95ca3689c7ebe0e9437661eb Mon Sep 17 00:00:00 2001 From: Daniel Barnes Date: Fri, 5 Aug 2022 14:49:40 -0700 Subject: [PATCH 4/4] debug log --- src/terraform.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/terraform.js b/src/terraform.js index bdfd17835..d99fd17f8 100644 --- a/src/terraform.js +++ b/src/terraform.js @@ -1,5 +1,6 @@ const fs = require('fs').promises; const { ltr } = require('semver'); +const winston = require('winston'); const { exec, tfCapture } = require('./utils'); const MIN_TF_VER = '0.14.0'; @@ -115,6 +116,7 @@ const iterativeCmlRunnerTpl = (opts = {}) => { } } }; + winston.debug(`terraform data: ${JSON.stringify(tfObj)}`); return tfObj; };