diff --git a/bin/cml/runner.js b/bin/cml/runner.js index 59025d73e..cafb54540 100755 --- a/bin/cml/runner.js +++ b/bin/cml/runner.js @@ -534,7 +534,6 @@ exports.builder = (yargs) => }, cloudSshPrivate: { type: 'string', - coerce: (val) => val && val.replace(/\n/g, '\\n'), description: 'Custom private RSA SSH key. If not provided an automatically generated throwaway key will be used' }, diff --git a/package-lock.json b/package-lock.json index c02b345f8..141da5d68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dvcorg/cml", - "version": "0.17.1", + "version": "0.17.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@dvcorg/cml", - "version": "0.17.1", + "version": "0.17.3", "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.8.2", diff --git a/package.json b/package.json index 288981e44..f0d3426c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dvcorg/cml", - "version": "0.17.1", + "version": "0.17.3", "description": "

", "author": { "name": "Iterative Inc", diff --git a/src/terraform.js b/src/terraform.js index 37dd856ac..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'; @@ -77,43 +78,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 = {}) => { + const tfObj = { + ...iterativeProviderTpl(opts), + resource: { + iterative_cml_runner: { + runner: { + ...(opts.awsSecurityGroup && { + aws_security_group: opts.awsSecurityGroup + }), + ...(opts.awsSubnet && { aws_subnet_id: 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 }) + } } } - } -}); + }; + winston.debug(`terraform data: ${JSON.stringify(tfObj)}`); + return tfObj; +}; const checkMinVersion = async () => { const ver = await version();