Skip to content
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

fix(lib): fix source path generated for local modules #947

Merged
merged 2 commits into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cdktf/lib/terraform-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export abstract class TerraformModule
super(scope, id);

if (options.source.startsWith("./") || options.source.startsWith("../")) {
this.source = path.join("..", options.source);
this.source = path.join("../../..", options.source);
} else {
this.source = options.source;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`add provider 1`] = `
\\"providers\\": {
\\"test\\": \\"test.provider1\\"
},
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
},
\\"provider\\": {
Expand Down Expand Up @@ -42,7 +42,7 @@ exports[`complex providers 1`] = `
\\"test.dst\\": \\"test.provider2\\",
\\"test.src\\": \\"test.provider1\\"
},
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
},
\\"provider\\": {
Expand Down Expand Up @@ -71,7 +71,7 @@ exports[`depend on module 1`] = `
"{
\\"module\\": {
\\"test\\": {
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
},
\\"provider\\": {
Expand Down Expand Up @@ -103,13 +103,13 @@ exports[`depend on other module 1`] = `
"{
\\"module\\": {
\\"test_1\\": {
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
},
\\"test_2\\": {
\\"depends_on\\": [
\\"module.test_1\\"
],
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
}
}"
Expand All @@ -119,7 +119,7 @@ exports[`minimal configuration 1`] = `
"{
\\"module\\": {
\\"test\\": {
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
}
}"
Expand All @@ -133,7 +133,7 @@ exports[`multiple providers 1`] = `
\\"differentType\\": \\"differentType\\",
\\"test\\": \\"test\\"
},
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
},
\\"provider\\": {
Expand Down Expand Up @@ -171,7 +171,7 @@ exports[`pass variables 1`] = `
\\"id1\\",
\\"id2\\"
],
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
}
}"
Expand All @@ -181,7 +181,7 @@ exports[`reference module 1`] = `
"{
\\"module\\": {
\\"test\\": {
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
},
\\"provider\\": {
Expand Down Expand Up @@ -210,7 +210,7 @@ exports[`reference module list 1`] = `
"{
\\"module\\": {
\\"test\\": {
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
},
\\"provider\\": {
Expand Down Expand Up @@ -241,7 +241,7 @@ exports[`set variable 1`] = `
\\"module\\": {
\\"test\\": {
\\"param1\\": \\"value1\\",
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
}
}"
Expand All @@ -254,7 +254,7 @@ exports[`simple provider 1`] = `
\\"providers\\": {
\\"test\\": \\"test.provider1\\"
},
\\"source\\": \\"../foo\\"
\\"source\\": \\"../../../foo\\"
}
},
\\"provider\\": {
Expand Down
4 changes: 2 additions & 2 deletions test/typescript/modules/__snapshots__/test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`full integration test build modules posix 1`] = `
},
\\"module\\": {
\\"localmodule\\": {
\\"source\\": \\"../local-module\\",
\\"source\\": \\"../../../local-module\\",
\\"//\\": {
\\"metadata\\": {
\\"path\\": \\"hello-modules/local-module\\",
Expand Down Expand Up @@ -55,7 +55,7 @@ exports[`full integration test build modules windows 1`] = `
},
\\"module\\": {
\\"localmodule\\": {
\\"source\\": \\"..\\\\\\\\local-module\\",
\\"source\\": \\"..\\\\\\\\..\\\\\\\\..\\\\\\\\local-module\\",
\\"//\\": {
\\"metadata\\": {
\\"path\\": \\"hello-modules/local-module\\",
Expand Down