-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(provider-generator): use module name that does not collide commonly
Closes #3026
- Loading branch information
1 parent
6bfb057
commit 767f5c9
Showing
5 changed files
with
96 additions
and
11 deletions.
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
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 |
---|---|---|
|
@@ -9,16 +9,8 @@ | |
} | ||
], | ||
"terraformModules": [ | ||
{ | ||
"name": "vpc", | ||
"source": "terraform-aws-modules/vpc/aws", | ||
"version": "2.77.0" | ||
}, | ||
{ | ||
"name": "eks", | ||
"source": "terraform-aws-modules/eks/aws", | ||
"version": "~> 15.0" | ||
} | ||
"terraform-aws-modules/vpc/[email protected]", | ||
"terraform-aws-modules/rds/[email protected]" | ||
], | ||
"codeMakerOutput": "imports" | ||
} | ||
|
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
80 changes: 80 additions & 0 deletions
80
packages/@cdktf/commons/src/construct-maker-target.test.ts
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,80 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import { Language, TerraformModuleConstraint } from "./config"; | ||
import { ConstructsMakerModuleTarget } from "./construct-maker-target"; | ||
|
||
describe("ConstructsMakerModuleTarget", () => { | ||
describe.each([ | ||
{ | ||
fqn: "cloudposse/label/null", | ||
names: { | ||
[Language.TYPESCRIPT]: "cloudposse.null", | ||
[Language.PYTHON]: "cloudposse.label.null", | ||
[Language.JAVA]: "cloudposse.label.null", | ||
[Language.CSHARP]: "cloudposse.label.null", | ||
[Language.GO]: "label", | ||
}, | ||
}, | ||
{ | ||
fqn: "terraform-google-modules/project-factory/google", | ||
names: { | ||
[Language.TYPESCRIPT]: "terraform_google_modules.google", | ||
[Language.PYTHON]: "terraform_google_modules.project_factory.google", | ||
[Language.JAVA]: "terraform_google_modules.project_factory.google", | ||
[Language.CSHARP]: "terraform_google_modules.project_factory.google", | ||
[Language.GO]: "project_factory", | ||
}, | ||
}, | ||
{ | ||
fqn: "terraform-aws-modules/vpc/[email protected]", | ||
names: { | ||
[Language.TYPESCRIPT]: "terraform_aws_modules.aws", | ||
[Language.PYTHON]: "terraform_aws_modules.vpc.aws", | ||
[Language.JAVA]: "terraform_aws_modules.vpc.aws", | ||
[Language.CSHARP]: "terraform_aws_modules.vpc.aws", | ||
[Language.GO]: "vpc", | ||
}, | ||
}, | ||
{ | ||
fqn: "terraform-aws-modules/eks/aws//modules/self-managed-node-group", | ||
names: { | ||
[Language.TYPESCRIPT]: "terraform_aws_modules.aws.eks.modules", | ||
[Language.PYTHON]: | ||
"terraform_aws_modules.eks.aws.modules.self_managed_node_group", | ||
[Language.JAVA]: | ||
"terraform_aws_modules.eks.aws.modules.self_managed_node_group", | ||
[Language.CSHARP]: | ||
"terraform_aws_modules.eks.aws.modules.self_managed_node_group", | ||
[Language.GO]: "self_managed_node_group", | ||
}, | ||
}, | ||
{ | ||
fqn: { | ||
name: "my-local-module", | ||
source: "./path/to/local/terraform/module", | ||
}, | ||
names: { | ||
[Language.TYPESCRIPT]: "my-local-module", | ||
[Language.PYTHON]: "my_local_module", | ||
[Language.JAVA]: "my_local_module", | ||
[Language.CSHARP]: "my_local_module", | ||
[Language.GO]: "my_local_module", | ||
}, | ||
}, | ||
])("#srcMakName %#", ({ fqn, names }) => { | ||
it.each(Object.entries(names))( | ||
`expect name for ${JSON.stringify(fqn)} in %s to be %s`, | ||
(language, name) => { | ||
const constraint = new TerraformModuleConstraint(fqn as any); | ||
const target = new ConstructsMakerModuleTarget( | ||
constraint, | ||
language as Language | ||
); | ||
expect(target.srcMakName).toBe(name); | ||
} | ||
); | ||
}); | ||
}); |
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