Coder Social home page Coder Social logo

cdktf / projen-cdktf-hybrid-construct Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 4.0 2.89 MB

Projen template for CDKTF Constructs that should also be used as Terraform Modules.

License: Mozilla Public License 2.0

TypeScript 96.31% HCL 1.29% Shell 2.40%
constructs cdk cdktf terraform-cdk terraform-modules projen

projen-cdktf-hybrid-construct's Issues

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

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

Use of `cdktf-tf-module-stack` instead of `@cdktf/tf-module-stack`

Description

After hitting some errors, one causing issue I believe is the use of cdktf-tf-module-stack instead of @cdktf/tf-module-stack in this project.
The now old (seemingly not maintained) cdktf-tf-module-stack package gets installed into node-modules and appears in dependencies after a fresh npx projen new --from projen-cdktf-hybrid-construct hybrid-module and causes package dependency issues. This is most probably because its use in https://github.com/cdktf/projen-cdktf-hybrid-construct/blob/main/src/hybrid-module.ts.

I believe this needs to be replaced with @cdktf/tf-module-stack.

Versions

language: null
cdktf-cli: 0.17.3
node: v18.16.1
terraform: 1.5.4
arch: arm64
os: darwin 22.5.0

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.