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

TFModuleStack created inside src sub folders are not getting synthesized on running build command #98

Open
1 task
ankitatdnv opened this issue Sep 14, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ankitatdnv
Copy link

Description

I have created a TFModule stack under directory "src/services/azure/static-app" as follows:

import {
  ProviderRequirement,
  TFModuleStack,
  TFModuleVariable,
} from "@cdktf/tf-module-stack";
import { App } from "cdktf";
import { Construct } from "constructs";
import { AzStaticApp } from "./main";

class AzStaticAppModule extends TFModuleStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);
    let azurermProvider = new ProviderRequirement(this, "azurerm", "~> 3.70.0", "hashicorp/azurerm");  

    new ProviderRequirement(this, "github", "~> 5.36.0", "integrations/github");

    let appName = new TFModuleVariable(this, "appName", {
      type: "string",
      description: "Name of the application",
      default: "test-app",
    });
    let environmentName = new TFModuleVariable(this, "environmentName", {
      type: "string",
      default: "dev",
    });
    let location = new TFModuleVariable(this, "location", {
      type: "string",
      default: "westeurope",
    });
    let skuSize = new TFModuleVariable(this, "skuSize", {
      type: "string"      
    });
    let skuTier = new TFModuleVariable(this, "skuTier", {
      type: "string"      
    });   
    
    let namePrefix = new TFModuleVariable(this, "namePrefix", {
      type: "string",
      description: "Prefix for all resources",
      default: "tf",
    }); 
    
    let apiLocation = new TFModuleVariable(this, "apiLocation", {
      type: "string", 
      default: "api"     
    });

    let appLocation = new TFModuleVariable(this, "appLocation", {
      type: "string"      
    });

    let appBuildCommand = new TFModuleVariable(this, "appBuildCommand", {
      type: "string"      
    });

    let repositoryName = new TFModuleVariable(this, "repositoryName", {
      type: "string"      
    });

    let branchName = new TFModuleVariable(this, "branchName", {
      type: "string"      
    });

    let apiTokenVar = new TFModuleVariable(this, "apiTokenVar", {
      type: "string"      
    });

    let outputLocation = new TFModuleVariable(this, "outputLocation", {
      type: "string"      
    });

    let existingRgName = new TFModuleVariable(this, "existingRgName", {
      type: "string",
      default: ""    
    });

    let providerAlias = new TFModuleVariable(this, "providerAlias", {
      type: "string",
      default: ""    
    });

    let tags = new TFModuleVariable(this, "tags", {
      type: "map(string)"      
    });

    azurermProvider.alias = providerAlias.value;
    new AzStaticApp(this, "static-app", {
      provider: azurermProvider,
      appName: appName.value,
      environmentName: environmentName.value,
      location: location.value,
      skuSize: skuSize.value,
      skuTier: skuTier.value,          
      namePrefix: namePrefix.value,
      apiLocation: apiLocation.value,
      appLocation: appLocation.value,
      appBuildCommand: appBuildCommand.value,
      repositoryName: repositoryName.value, 
      branchName: branchName.value,
      apiTokenVar: apiTokenVar.value,
      outputLocation: outputLocation.value,
      tags: tags.value,
      existingRgName: existingRgName.value           
    });
  }
}

const app = new App();
// This is the name the module can be found under.
// We expect a "my-awesome-module.md" file in this directory.
// The README.md file will be generated from this file.
new AzStaticAppModule(app, "az-static-app");
app.synth();

Directory Structure:
image

Versions

language: null
cdktf-cli: 0.18.0
node: v18.17.1
terraform: 1.5.2
arch: x64
os: win32 10.0.19045

Providers

No response

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@ankitatdnv ankitatdnv added the bug Something isn't working label Sep 14, 2023
@ankitatdnv
Copy link
Author

On running build command, It just synthesized the TFModules which are directly under src folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant