Skip to content

Commit

Permalink
chore: put aspects at the root of stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Maed223 committed Nov 29, 2023
1 parent dbc2b1c commit 51e2c92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 0 additions & 3 deletions lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import { Construct } from "constructs";
import { Aspects, MigrateIds } from "cdktf";
import { SecretFromVariable } from "./secrets";
import { GithubProvider } from "@cdktf/provider-github/lib/provider";
import { Repository } from "@cdktf/provider-github/lib/repository";
Expand Down Expand Up @@ -119,8 +118,6 @@ export class GithubRepository extends Construct {
} = config;
this.provider = provider;

Aspects.of(this).add(new MigrateIds());

this.resource = new Repository(this, "repo", {
name,
description,
Expand Down
12 changes: 10 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
TerraformOutput,
RemoteBackend,
Annotations,
Aspects,
MigrateIds,
} from "cdktf";
import {
GithubRepository,
Expand Down Expand Up @@ -357,10 +359,15 @@ if (!stackNames.includes(primaryStackName)) {
}

stackNames.forEach((stackName) => {
new TerraformCdkProviderStack(app, stackName, primaryStackName === stackName);
const providerStack = new TerraformCdkProviderStack(
app,
stackName,
primaryStackName === stackName
);
Aspects.of(providerStack).add(new MigrateIds());
});

new CustomConstructsStack(app, "custom-constructs", [
const customConstructs = new CustomConstructsStack(app, "custom-constructs", [
{
name: "cdktf-tf-module-stack",
languages: ["typescript", "python", "csharp", "java", "go"],
Expand All @@ -379,5 +386,6 @@ new CustomConstructsStack(app, "custom-constructs", [
languages: ["typescript", "python"],
},
]);
Aspects.of(customConstructs).add(new MigrateIds());

app.synth();

0 comments on commit 51e2c92

Please sign in to comment.