Skip to content

Commit

Permalink
feat(terraform): add v0.13.3 as a supported version
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Sep 22, 2020
1 parent f09deae commit 18db4ef
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
37 changes: 37 additions & 0 deletions core/src/plugins/terraform/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,43 @@ export const terraformCliSpecs: { [version: string]: PluginToolSpec } = {
},
],
},
"0.13.3": {
name: "terraform-0-13-3",
description: "The terraform CLI, v0.13.3",
type: "binary",
builds: [
{
platform: "darwin",
architecture: "amd64",
url: "https://releases.hashicorp.com/terraform/0.13.3/terraform_0.13.3_darwin_amd64.zip",
sha256: "ccbfd3af8732a47b6bd32c419e1a52e41eb8a39ff7437afffbef438b5c0f92c3",
extract: {
format: "zip",
targetPath: "terraform",
},
},
{
platform: "linux",
architecture: "amd64",
url: "https://releases.hashicorp.com/terraform/0.13.3/terraform_0.13.3_linux_amd64.zip",
sha256: "35c662be9d32d38815cde5fa4c9fa61a3b7f39952ecd50ebf92fd1b2ddd6109b",
extract: {
format: "zip",
targetPath: "terraform",
},
},
{
platform: "windows",
architecture: "amd64",
url: "https://releases.hashicorp.com/terraform/0.13.3/terraform_0.13.3_windows_amd64.zip",
sha256: "e4aba639b2fb946c5c17b982c22c8ff3a7a3c07725978284ffc1cc651961da2c",
extract: {
format: "zip",
targetPath: "terraform.exe",
},
},
],
},
}

export const supportedVersions = Object.keys(terraformCliSpecs)
Expand Down
12 changes: 7 additions & 5 deletions core/src/plugins/terraform/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ export async function tfValidate({
ctx,
provider,
root,
variables,
}: {
log: LogEntry
ctx: PluginContext
provider: TerraformProvider
root: string
variables: object
}) {
const args = ["validate", "-json", ...(await prepareVariables(root, variables))]
const args = ["validate", "-json"]

const res = await terraform(ctx, provider).json({
log,
Expand All @@ -55,7 +53,11 @@ export async function tfValidate({
if (res.valid === false) {
const reasons = res.diagnostics.map((d: any) => d.summary)

if (reasons.includes("Could not satisfy plugin requirements") || reasons.includes("Module not installed")) {
if (
reasons.includes("Could not satisfy plugin requirements") ||
reasons.includes("Module not installed") ||
reasons.includes("Could not load plugin")
) {
// We need to run `terraform init` and retry validation
log.debug("Initializing Terraform")
await terraform(ctx, provider).exec({ log, args: ["init"], cwd: root, timeoutSec: 300 })
Expand Down Expand Up @@ -130,7 +132,7 @@ export async function getStackStatus({
root,
variables,
}: GetTerraformStackStatusParams): Promise<StackStatus> {
await tfValidate({ log, ctx, provider, root, variables })
await tfValidate({ log, ctx, provider, root })

const logEntry = log.verbose({ section: "terraform", msg: "Running plan...", status: "active" })

Expand Down

0 comments on commit 18db4ef

Please sign in to comment.