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

COMPONENT: Action isn't working with python example of terraform-cdk #234

Open
1 task
Geoffrey-Schuette-Simpli-Fi opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working new A new issue or feature request that has not yet been triaged by maintainers

Comments

@Geoffrey-Schuette-Simpli-Fi

Description

I am trying to use this action to plan out a creation of a GIthub repository in our organization. I have followed the examples as they were written in the README, and once I got some of the standard config cleaned up, I started to get an error that pipenv wasn't installed which caused cdktf to fail. I then tried to ensure that pipenv was installed, and after it was installed, pipenv would say that it couldn't install cdktf.

Here is the action:

name: "Comment a Plan on a PR"

on: [pull_request]

permissions:
  contents: read
  pull-requests: write

jobs:
  terraform:
    name: "Terraform CDK Diff"
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Generate a token
        id: generate-token
        uses: actions/create-github-app-token@v1
        with:
          app-id: ${{ vars.APP_ID }}
          private-key: ${{ secrets.PRIVATE_KEY }}

      - name: Set up Python 3.11
        uses: actions/setup-python@v1
        with:
          python-version: 3.11
      - name: Install pipenv
        run: pip install pipenv

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Install dependencies
        run: yarn install

      - name: Generate module and provider bindings
        run: npx cdktf-cli get

      - name: Run Terraform CDK
        uses: hashicorp/terraform-cdk-action@v5
        with:
          cdktfVersion: 0.20.10
          terraformVersion: 1.5.7
          mode: plan-only
          stackName: terraform-cdk-github-python-ex
          githubToken: ${{ steps.generate-token.outputs.token }}
          cdktfArgs: --var='github_Oauth_token=${{ steps.generate-token.outputs.token }}'

Here is the output to the failu of the Generate Module and provider bindings

Run npx cdktf-cli get
  npx cdktf-cli get
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.11.10/x64
npm warn exec The following package was not found and will be installed: cdktf-cli@0.[2](https://github.com/simplifi-dev/terraform-cdk-github-python-ex/actions/runs/12038987736/job/33565855084?pr=1#step:8:2)0.10
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected].[3](https://github.com/simplifi-dev/terraform-cdk-github-python-ex/actions/runs/12038987736/job/33565855084?pr=1#step:8:3): Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
Creating a virtualenv for this project
Error: 02[4](https://github.com/simplifi-dev/terraform-cdk-github-python-ex/actions/runs/12038987736/job/33565855084?pr=1#step:8:4)-11-26T21:0[5](https://github.com/simplifi-dev/terraform-cdk-github-python-ex/actions/runs/12038987736/job/33565855084?pr=1#step:8:5):01.137] [ERROR] default - Creating a virtualenv for this project
Pipfile: 
Error: 024-11-2[6](https://github.com/simplifi-dev/terraform-cdk-github-python-ex/actions/runs/12038987736/job/33565855084?pr=1#step:8:7)T21:05:01.140] [ERROR] default - Pipfile: 
/home/runner/work/terraform-cdk-github-python-ex/terraform-cdk-github-python-ex/
Pipfile
/home/runner/work/terraform-cdk-github-python-ex/terraform-cdk-github-python-ex/
Pipfile
Using /opt/hostedtoolcache/Python/3.11.10/x64/bin/python33.11.10 to create 
virtualenv...
Error: 024-11-26T21:05:01.154] [ERROR] default - Using /opt/hostedtoolcache/Python/3.11.10/x64/bin/python33.11.10 to create 
virtualenv...
created virtual environment CPython3.11.10.final.0-64 in [7](https://github.com/simplifi-dev/terraform-cdk-github-python-ex/actions/runs/12038987736/job/33565855084?pr=1#step:8:8)34ms
Error: 024-11-26T21:05:02.138] [ERROR] default - created virtual environment CPython3.11.10.final.0-64 in 734ms
  creator 
  creator 
CPython3Posix(dest=/home/runner/.local/share/virtualenvs/terraform-cdk-github-py
CPython3Posix(dest=/home/runner/.local/share/virtualenvs/terraform-cdk-github-py
thon-ex-y3r-VrWV, clear=False, no_vcs_ignore=False, global=False)
thon-ex-y3r-VrWV, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, 
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, 
wheel=bundle, via=copy, app_data_dir=/home/runner/.local/share/virtualenv)
wheel=bundle, via=copy, app_data_dir=/home/runner/.local/share/virtualenv)
    added seed packages: pip==24.3.1, setuptools==75.6.0, wheel==0.45.1
    added seed packages: pip==24.3.1, setuptools==75.6.0, wheel==0.45.1
  activators 
  activators 
BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator
BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator
,PythonActivator
,PythonActivator
Successfully created virtual environment!
Error: 024-11-26T21:05:02.143] [ERROR] default - Successfully created virtual environment!
Virtualenv location: /home/runner/.local/share/virtualenvs/terraform-cdk-github-python-ex-y3r-VrWV
Error: 024-11-26T21:05:02.230] [ERROR] default - Virtualenv location: /home/runner/.local/share/virtualenvs/terraform-cdk-github-python-ex-y3r-VrWV
WARNING: Package(s) not found: cdktf
Error: 024-11-26T21:05:03.624] [ERROR] default - WARNING: Package(s) not found: cdktf
WARNING: Package(s) not found: cdktf
Error: 024-11-26T21:05:04.1[8](https://github.com/simplifi-dev/terraform-cdk-github-python-ex/actions/runs/12038987736/job/33565855084?pr=1#step:8:9)1] [ERROR] default - WARNING: Package(s) not found: cdktf
Generated python constructs in the output directory: imports

Are there any examples of how this can work with a python approach?

GitHub Action Version

v4.2.2

Configuration

cdktfVersion: 0.20.10
terraformVersion: 1.5.7
mode: plan-only
stackName: terraform-cdk-github-python-ex
githubToken: ${{ steps.generate-token.outputs.token }}
cdktfArgs: --var='github_Oauth_token=${{ steps.generate-token.outputs.token }}'

Gist

No response

Possible Solutions

No response

Workarounds

Installing pipenv first solved one issues, but now pipenv can't find cdktf.

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
@Geoffrey-Schuette-Simpli-Fi Geoffrey-Schuette-Simpli-Fi added bug Something isn't working new A new issue or feature request that has not yet been triaged by maintainers labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new A new issue or feature request that has not yet been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant