@cdktn/provider-schema 0.25.0-pre.2 → 0.25.0-pre.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__tests__/cache.test.js +18 -8
- package/build/__tests__/provider-schema.test.js +59 -8
- package/build/__tests__/provider-schema.unit.test.js +242 -1
- package/build/__tests__/read-emission-gap-warning.unit.test.js +18 -8
- package/build/cache.js +19 -10
- package/build/emission-check.js +22 -12
- package/build/provider-schema.d.ts +16 -1
- package/build/provider-schema.d.ts.map +1 -1
- package/build/provider-schema.js +210 -16
- package/build/read.js +3 -3
- package/build/util.d.ts +0 -3
- package/build/util.d.ts.map +1 -1
- package/build/util.js +20 -10
- package/package.json +7 -6
- package/src/__tests__/__snapshots__/provider-schema.test.ts.snap +69 -0
- package/src/__tests__/fixtures/local-json-module-provider-aliases/module.tf.json +21 -0
- package/src/__tests__/fixtures/local-mixed-module-provider-aliases/aliases.tf.json +10 -0
- package/src/__tests__/fixtures/local-mixed-module-provider-aliases/module.tf +22 -0
- package/src/__tests__/fixtures/local-module-provider-aliases/module.tf +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdktn/provider-schema",
|
|
3
|
-
"version": "0.25.0-pre.
|
|
3
|
+
"version": "0.25.0-pre.21",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
"deepmerge": "4.3.1",
|
|
33
33
|
"fs-extra": "11.3.6",
|
|
34
34
|
"semver": "7.8.5",
|
|
35
|
-
"@cdktn/commons": "0.25.0-pre.
|
|
36
|
-
"@cdktn/hcl2json": "0.25.0-pre.
|
|
35
|
+
"@cdktn/commons": "0.25.0-pre.21",
|
|
36
|
+
"@cdktn/hcl2json": "0.25.0-pre.21"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@types/node": "22.20.1",
|
|
39
40
|
"@types/fs-extra": "11.0.4",
|
|
40
41
|
"@types/semver": "7.7.1",
|
|
41
42
|
"safe-stable-stringify": "2.5.0",
|
|
42
43
|
"tsc-files": "1.1.4",
|
|
43
|
-
"typescript": "
|
|
44
|
+
"typescript": "~6.0.0"
|
|
44
45
|
},
|
|
45
46
|
"lint-staged": {
|
|
46
47
|
"src/**/*.{ts,tsx}": "tsc-files ambient.d.ts --noEmit"
|
|
@@ -50,8 +51,8 @@
|
|
|
50
51
|
"watch": "tsc -w",
|
|
51
52
|
"watch-preserve-output": "tsc -w --preserveWatchOutput",
|
|
52
53
|
"test:update": "jest -u",
|
|
53
|
-
"package": "
|
|
54
|
+
"package": "bash package.sh",
|
|
54
55
|
"dist-clean": "rm -rf dist",
|
|
55
|
-
"package:js": "
|
|
56
|
+
"package:js": "bash package.sh"
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -30,6 +30,29 @@ exports[`readSchema generates a local json module 1`] = `
|
|
|
30
30
|
}"
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
|
+
exports[`readSchema generates a local json module that requires provider configuration aliases 1`] = `
|
|
34
|
+
"{
|
|
35
|
+
"format_version": "STUBBED VERSION",
|
|
36
|
+
"local_module": {
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"default": "module",
|
|
40
|
+
"description": "Name of the DigitalOcean static site",
|
|
41
|
+
"name": "name",
|
|
42
|
+
"required": false,
|
|
43
|
+
"type": "any"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"name": "local_module",
|
|
47
|
+
"outputs": [
|
|
48
|
+
{
|
|
49
|
+
"name": "uri"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}"
|
|
54
|
+
`;
|
|
55
|
+
|
|
33
56
|
exports[`readSchema generates a local module 1`] = `
|
|
34
57
|
"{
|
|
35
58
|
"format_version": "STUBBED VERSION",
|
|
@@ -68,6 +91,52 @@ exports[`readSchema generates a local module 1`] = `
|
|
|
68
91
|
}"
|
|
69
92
|
`;
|
|
70
93
|
|
|
94
|
+
exports[`readSchema generates a local module that declares provider configuration aliases across .tf and .tf.json files 1`] = `
|
|
95
|
+
"{
|
|
96
|
+
"format_version": "STUBBED VERSION",
|
|
97
|
+
"local_module": {
|
|
98
|
+
"inputs": [
|
|
99
|
+
{
|
|
100
|
+
"description": "Name of the s3 bucket. Must be unique.",
|
|
101
|
+
"name": "bucket_name",
|
|
102
|
+
"required": true,
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"name": "local_module",
|
|
107
|
+
"outputs": [
|
|
108
|
+
{
|
|
109
|
+
"description": "ARN of the bucket",
|
|
110
|
+
"name": "arn"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}"
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
exports[`readSchema generates a local module that requires provider configuration aliases 1`] = `
|
|
118
|
+
"{
|
|
119
|
+
"format_version": "STUBBED VERSION",
|
|
120
|
+
"local_module": {
|
|
121
|
+
"inputs": [
|
|
122
|
+
{
|
|
123
|
+
"description": "Name of the s3 bucket. Must be unique.",
|
|
124
|
+
"name": "bucket_name",
|
|
125
|
+
"required": true,
|
|
126
|
+
"type": "string"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"name": "local_module",
|
|
130
|
+
"outputs": [
|
|
131
|
+
{
|
|
132
|
+
"description": "ARN of the bucket",
|
|
133
|
+
"name": "arn"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
}"
|
|
138
|
+
`;
|
|
139
|
+
|
|
71
140
|
exports[`readSchema generates a local module with inline comments in type constraints 1`] = `
|
|
72
141
|
"{
|
|
73
142
|
"format_version": "STUBBED VERSION",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"terraform": {
|
|
3
|
+
"required_providers": {
|
|
4
|
+
"null": {
|
|
5
|
+
"source": "hashicorp/null",
|
|
6
|
+
"configuration_aliases": ["null.extra"]
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"variable": {
|
|
11
|
+
"name": {
|
|
12
|
+
"default": "module",
|
|
13
|
+
"description": "Name of the DigitalOcean static site"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"output": {
|
|
17
|
+
"uri": {
|
|
18
|
+
"value": "${digitalocean_app.static_site}"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Copyright (c) HashiCorp, Inc.
|
|
2
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
|
|
4
|
+
# One half of a module that spreads its terraform settings across .tf and
|
|
5
|
+
# .tf.json files. Terraform allows several terraform blocks but only one
|
|
6
|
+
# required_providers configuration, so the provider requirements live in the
|
|
7
|
+
# .tf.json half - which hcl2json merges into a shape that hides them from a
|
|
8
|
+
# plain walk over the parsed terraform blocks.
|
|
9
|
+
|
|
10
|
+
terraform {
|
|
11
|
+
required_version = ">= 1.0"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
variable "bucket_name" {
|
|
15
|
+
description = "Name of the s3 bucket. Must be unique."
|
|
16
|
+
type = string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
output "arn" {
|
|
20
|
+
description = "ARN of the bucket"
|
|
21
|
+
value = aws_s3_bucket.s3_bucket.arn
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Copyright (c) HashiCorp, Inc.
|
|
2
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
|
|
4
|
+
# A module that expects its caller to hand it extra provider configurations,
|
|
5
|
+
# the way multi-region AWS modules do.
|
|
6
|
+
|
|
7
|
+
terraform {
|
|
8
|
+
required_providers {
|
|
9
|
+
aws = {
|
|
10
|
+
source = "hashicorp/aws"
|
|
11
|
+
configuration_aliases = [aws.global_region, aws.secondary_region]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
variable "bucket_name" {
|
|
17
|
+
description = "Name of the s3 bucket. Must be unique."
|
|
18
|
+
type = string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
output "arn" {
|
|
22
|
+
description = "ARN of the bucket"
|
|
23
|
+
value = aws_s3_bucket.s3_bucket.arn
|
|
24
|
+
}
|