-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cdktf): support dot-seperated nested accessors
Closes #3420
- Loading branch information
1 parent
f311d86
commit 3ff1890
Showing
3 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/cdktf/test/__snapshots__/terraform-provisioner.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`self with 1`] = ` | ||
"{ | ||
"provider": { | ||
"test": [ | ||
{ | ||
} | ||
] | ||
}, | ||
"resource": { | ||
"test_resource": { | ||
"bar": { | ||
"name": "test", | ||
"provisioner": [ | ||
{ | ||
"local-exec": { | ||
"command": "say 'hello world'", | ||
"environment": { | ||
"ECR_IMAGE_COMMAND": "delete", | ||
"ECR_IMAGE_SOURCE_IMAGE": "\${self.triggers_replace.source_image}", | ||
"ECR_IMAGE_TARGET_IMAGE": "\${self.image_name_with_hash}", | ||
"ECR_IMAGE_TARGET_REGION": "\${self.triggers_replace.target_region}" | ||
}, | ||
"interpreter": [ | ||
"bash" | ||
], | ||
"when": "destroy" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"terraform": { | ||
"required_providers": { | ||
"test": { | ||
"version": "~> 2.0" | ||
} | ||
} | ||
} | ||
}" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) HashiCorp, Inc | ||
// SPDX-License-Identifier: MPL-2.0 | ||
import { Testing, TerraformStack, TerraformSelf } from "../lib"; | ||
import { TestResource } from "./helper"; | ||
import { TestProvider } from "./helper/provider"; | ||
|
||
test("self with ", () => { | ||
const app = Testing.app(); | ||
const stack = new TerraformStack(app, "test"); | ||
new TestProvider(stack, "foo", {}); | ||
new TestResource(stack, "bar", { | ||
name: "test", | ||
provisioners: [ | ||
{ | ||
when: "destroy", | ||
type: "local-exec", | ||
environment: { | ||
ECR_IMAGE_COMMAND: "delete", | ||
ECR_IMAGE_SOURCE_IMAGE: TerraformSelf.getString( | ||
"triggers_replace.sourceImage" | ||
), | ||
ECR_IMAGE_TARGET_IMAGE: TerraformSelf.getString( | ||
"image_name_with_hash" | ||
), | ||
ECR_IMAGE_TARGET_REGION: TerraformSelf.getString( | ||
"triggers_replace.target_region" | ||
), | ||
}, | ||
interpreter: ["bash"], | ||
command: "say 'hello world'", | ||
}, | ||
], | ||
}); | ||
expect(Testing.synth(stack)).toMatchSnapshot(); | ||
}); |