-
Notifications
You must be signed in to change notification settings - Fork 23
feat: support newer provider plugin-protocol features via targetVersions (RFC-04) #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
so0k
wants to merge
28
commits into
main
Choose a base branch
from
feat/provider-feature-availability
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,373
−63
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
816d590
chore: vendor provider-feature availability matrix
so0k de9ad48
feat(lib): TerraformEphemeralResource with targetVersions validation
so0k 402f21b
feat(provider-generator): acquire newer provider-protocol schema sect…
so0k 4246f26
feat(provider-generator): generate ephemeral resource bindings
so0k fe3ecf2
feat(provider-generator): generate provider-defined function bindings
so0k 014763e
feat(provider-generator): deprecate write-only attribute getters, val…
so0k d932180
feat(cli): thread targetVersions into cdktn get
so0k a382d96
fix(provider-generator): tolerate malformed targetVersions on the get…
so0k 45d521a
fix(lib): restrict ephemeral resource lifecycle to pre/postconditions
so0k 0b938e0
docs(provider-generator): warn against provider-fn self-reference in …
so0k 268d54c
fix(lib): scope usage registries to one App synthesis session
so0k cd6d080
fix(provider-generator): warn about emission gaps on schema cache hit…
so0k b52a48b
docs: point the hand-maintained constraint maps at the vendored matrix
so0k f7c6c3b
fix(lib): render null provider-function arguments instead of dropping…
so0k 68bdcdc
fix(provider-generator): return raw resolvable for dynamic provider-f…
so0k 82e34b4
refactor(lib): type registerProviderFeatureUsage with a ProviderFeatu…
so0k 30b1724
test: add version-boundary scenarios for target-version checks
so0k 267360b
fix(provider-generator): model provider-function schema JSON accurately
so0k 80945aa
feat(provider-generator): recursive, honest provider-function type ma…
so0k 8a1af87
fix(lib): own function usage registries by App instead of process
so0k 8bf9ddf
feat(provider-generator): move provider functions onto the provider c…
so0k 99ab8e5
fix(lib): provider-feature hook on TerraformElement, honest enum inde…
so0k d6e859f
fix(provider-generator): make generated provider-function code run un…
so0k 58cd428
test(provider-generator): edge-provider compile coverage for function…
so0k 045ecb2
fix(provider-generator): reserve generated wrapper member names in fu…
so0k 60d933c
fix(lib)!: write-only target validation derives from rendered values,…
so0k fc5cd9d
fix(lib): HCL renderer omits attribute descriptors whose value resolv…
so0k 0eb1a1a
fix(lib): provider-feature and function usage represent the current s…
so0k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
55 changes: 55 additions & 0 deletions
55
packages/@cdktn/cli-core/src/test/lib/cdktf-config.test.ts
This file contains hidden or 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,55 @@ | ||
| // Copyright (c) HashiCorp, Inc | ||
| // SPDX-License-Identifier: MPL-2.0 | ||
| import * as fs from "fs"; | ||
| import * as os from "os"; | ||
| import * as path from "path"; | ||
| import { logger } from "@cdktn/commons"; | ||
| import { CdktfConfig } from "../../lib/cdktf-config"; | ||
|
|
||
| describe("CdktfConfig.targetVersions", () => { | ||
| let tmpDir: string; | ||
|
|
||
| beforeEach(() => { | ||
| tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "cdktf-config-test-")); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| fs.rmSync(tmpDir, { recursive: true, force: true }); | ||
| jest.restoreAllMocks(); | ||
| }); | ||
|
|
||
| function writeConfig(targetVersions: unknown): string { | ||
| const cdktfConfigPath = path.join(tmpDir, "cdktf.json"); | ||
| fs.writeFileSync( | ||
| cdktfConfigPath, | ||
| JSON.stringify({ language: "typescript", app: "", targetVersions }), | ||
| ); | ||
| return cdktfConfigPath; | ||
| } | ||
|
|
||
| it("returns a well-formed targetVersions unchanged", () => { | ||
| const cdktfConfigPath = writeConfig({ terraform: ">=1.5.7" }); | ||
| const config = new CdktfConfig(cdktfConfigPath); | ||
|
|
||
| expect(config.targetVersions).toEqual({ terraform: ">=1.5.7" }); | ||
| }); | ||
|
|
||
| it("warns and returns undefined for a malformed targetVersions instead of throwing", () => { | ||
| const warnSpy = jest.spyOn(logger, "warn").mockImplementation(() => {}); | ||
| const cdktfConfigPath = writeConfig({ terraform: "not-a-range" }); | ||
| const config = new CdktfConfig(cdktfConfigPath); | ||
|
|
||
| expect(() => config.targetVersions).not.toThrow(); | ||
| expect(config.targetVersions).toBeUndefined(); | ||
| expect(warnSpy).toHaveBeenCalledWith( | ||
| expect.stringContaining("not-a-range"), | ||
| ); | ||
| }); | ||
|
|
||
| it("returns undefined when targetVersions is not declared", () => { | ||
| const cdktfConfigPath = writeConfig(undefined); | ||
| const config = new CdktfConfig(cdktfConfigPath); | ||
|
|
||
| expect(config.targetVersions).toBeUndefined(); | ||
| }); | ||
| }); |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.