fix(terraform): handle whitespace better in replace

This commit is contained in:
Rhys Arkins 2018-10-17 06:38:41 +02:00
parent f71ee0ef9f
commit 148126859d
2 changed files with 3 additions and 3 deletions

View file

@ -14,7 +14,7 @@ function updateDependency(currentFileContent, upgrade) {
} }
newLine = lineToChange.replace(/\?ref=.*"/, `?ref=${upgrade.newValue}"`); newLine = lineToChange.replace(/\?ref=.*"/, `?ref=${upgrade.newValue}"`);
} else if (upgrade.depType === 'terraform') { } else if (upgrade.depType === 'terraform') {
if (!lineToChange.includes('version = "')) { if (!lineToChange.match(/version\s*=\s*"/)) {
return null; return null;
} }
newLine = lineToChange.replace( newLine = lineToChange.replace(

View file

@ -7,8 +7,8 @@ module "bar" {
} }
module "consul" { module "consul" {
source = "hashicorp/consul/aws" source = "hashicorp/consul/aws"
version = "0.1.0" version = "0.1.0"
} }
module "container_definition" { module "container_definition" {