I'm trying to deploy a stack using pulumi in my AWS account. My deploy.yml looks like this:
name: Pushes Glue Scripts to S3
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy jobs
uses: pulumi/actions@v5
id: pulumi
env:
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
with:
command: up
cloud-url: s3://my-bucket/pulumi/
stack-name: dev
In my repository I have my stack file named Pulumi.dev.yaml. The file itself have just an encryption salt code. It's important to say I configured the pulumi backend into my S3 bucket using the command: pulumi login s3://my-bucket/pulumi.
However, when I run my deploy code, I get the following error:
StackNotFoundError: code: -2
stdout:
stderr: Command failed with exit code 255: pulumi stack select --stack dev --non-interactive
error: no stack named 'dev' found
err?: Error: Command failed with exit code 255: pulumi stack select --stack dev --non-interactive
error: no stack named 'dev' found
I believe the container which runs the pulumi up code isn't seeing my stack. So, how can I fix this? Is there any step to check when runing my Github Actions with Pulumi?
After several days I managed to find a solution, although I believe it's not the best or suitable one. I had to refactor all my deployment script to achieve what I needed. Bellow, follows the script and an explanation:
The
pulumi/actions@v5didn't work for me. Then I had to split all the process of deploying services using pulumi.First, I need to install pulumi and configure the AWS credentials. As I'm using poetry to manage my dependencies, I added a step to install, configure, and manage it. Then, I assured to run pulumi from my environment using poetry commands.
Well, as I said, this worked. But it can be improved? I believe so. Therefore, please feel free to add a more suitable answer. For now, I'm keeping this.