terraform-aws-modules / terraform-aws-vpc

Terraform module to create AWS VPC resources πŸ‡ΊπŸ‡¦
https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws
Apache License 2.0
2.92k stars 4.37k forks source link

Module for Terraform CDK does not work #935

Closed fdervisi closed 1 year ago

fdervisi commented 1 year ago

Description

Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/* directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply without any further changes.

If your request is for a new feature, please use the Feature request template.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

4.0.1

Reproduction Code [Required]

--snip--
import { Vpc } from './.gen/modules/vpc';
--snip--
    this.vpc = new Vpc(this, 'vpc', {
      name: 'vpc-eks-app',
      cidr: '10.0.0.0/16',
      azs: allAvailabilityZones,
      publicSubnets: ['10.0.1.0/24', '10.0.2.0/24', '10.0.3.0/24'],
      privateSubnets: [
        '10.0.4.0/24',
        '10.0.5.0/24',
        '10.0.6.0/24',
        '10.0.7.0/24',
      ],
      enableNatGateway: true,
      singleNatGateway: true,
      enableDnsHostnames: true,
      tags: {
        [`kubernetes.io/cluster/${clusterName}`]: 'shared',
      },
      publicSubnetTags: {
        [`kubernetes.io/cluster/${clusterName}`]: 'shared',
        'kubernetes.io/role/elb': '1',
      },
      privateSubnetTags: {
        [`kubernetes.io/cluster/${clusterName}`]: 'shared',
        'kubernetes.io/role/internal-elb': '1',
      },
    });
--snip--

Steps to reproduce the behavior:

cdktf get
cdktf deploy

Expected behavior

The Terraform CDK module should function as intended, allowing for successful utilization based on the provided instructions.

module should be used

Actual behavior

ubuntu$ cdktf deploy
app  Running apply in Terraform Cloud. Output will stream here. Pressing Ctrl-C
         will cancel the remote apply if it's still pending. If the apply started it
         will stop streaming the logs, but will not stop the apply running remotely.

         Preparing the remote apply...

app  β•·
         β”‚ Error: error loading config with snapshot: cdk.tf.json:25,12-13: Module not installed; This module is not yet installed. Run "terraform init" to install all modules required by this configuration.
         β”‚ 
         β”‚ 
         β•΅

0 Stacks deploying     1 Stack done     0 Stacks waiting
Invoking Terraform CLI failed with exit code 1

This is this the cdktf.json

{
  "language": "typescript",
  "app": "npx ts-node main.ts",
  "projectId": "36c31cb2-be41-4217-890f-02eea2057b10",
  "sendCrashReports": "false",
  "terraformProviders": [],
  "terraformModules": [
    {
      "name": "vpc",
      "source": "terraform-aws-modules/vpc/aws",
      "version": "4.0.1"
    }
  ],
  "context": {
    "excludeStackIdFromLogicalIds": "true",
    "allowSepCharsInLogicalIds": "true"
  }
}

Additional context

I am encountering difficulties with the Terraform CDK module, as it does not seem to be working properly. I have followed the provided instructions diligently and have even attempted to download the required modules locally, but unfortunately, I have been unable to resolve the issue.

Thanks Cheers Fatos

antonbabenko commented 1 year ago

Please ask such questions on discuss.hashicorp.com. Terraform for CDK is a separate product and has no relation to this Terraform module.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.