refined-terabyte-65361
02/28/2022, 8:32 PMimport * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
// Create an AWS resource (S3 Bucket)
const bucket = new aws.s3.Bucket("accessRequests3Bucket");
// Export the name of the bucket
export const bucketName = bucket.id;
i am able to see that in my github actions also
pulumi up on dev
Updating (dev):
pulumi:pulumi:Stack s3-dev running
aws:s3:Bucket accessRequestBucket
pulumi:pulumi:Stack s3-dev
Outputs:
bucketName: "accessrequestbucket-6500d31"
Resources:
2 unchanged
Duration: 3s
apologies if this question is not related to pulumi
Thankslittle-cartoon-10569
02/28/2022, 8:35 PMpulumi stack output
and grab the value from there.refined-terabyte-65361
02/28/2022, 8:39 PM- name: upload package to bucket
run: aws s3 cp accessRequest.zip <s3-bucket-name>
i will try adding pulumi stack output
thanks- uses: pulumi/actions@v3
name: get s3 bucket name to push package
with:
command: output
stack-name: dev
work-dir: awsResource/s3
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
error:
Error: Expected { command: "up" | "update" | "refresh" | "destroy" | "preview"; stackName: string; workDir: string; commentOnPr: boolean; options: { parallel?: number; message?: string; expectNoChanges?: boolean; diff?: boolean; replace?: string[]; target?: string[]; targetDependents?: boolean; editCommentOnPr?: boolean; userAgent?: "pulumi/actions@v3"; }; }, but was incompatible
little-cartoon-10569
02/28/2022, 9:00 PMstack
command. If you need it in another step, then you need to run the pulumi
command directly, and parse its output.refined-terabyte-65361
02/28/2022, 9:04 PM- uses: pulumi/actions@v3
with:
command: up
stack-name: dev
#comment-on-pr: true
upsert: true
refresh: true
work-dir: awsResource/s3
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
- name: upload foo package to bucket
run: aws s3 cp foo.zip <bucket name from output of pulumi up >
little-cartoon-10569
02/28/2022, 9:12 PMpulumi stack output | grep bucketName
or similar. Unless the Pulumi action can store outputs in a workflow variable or similar... I don't think I've read anything about that.refined-terabyte-65361
02/28/2022, 9:57 PM- name: get s3 bucket name to push package
id: pulumiStackOutput
working-directory: awsResource/s3
env:
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
run: echo ::set-output name=bucketname::$(pulumi login ${{ secrets.AWS_BUCKET }} > /dev/null 2>&1 && pulumi stack output -j | jq -r .bucketName)
- name: print bucket name
run: echo ${{ steps.pulumiStackOutput.outputs.bucketname }}
little-cartoon-10569
02/28/2022, 10:06 PM