From 804f14f625541f711d8a478f5282f7740e60a7fc Mon Sep 17 00:00:00 2001 From: Anton Tayanovskyy Date: Mon, 28 Oct 2024 09:25:07 -0400 Subject: [PATCH] Fix IMDSv2 test to allow /tmp to be immutable (#4673) The IMDSv2 test provisions a RC of the pulumi-aws-provider inside an AWS test account and checks if it can authenticate. Unfortunately something changed in the cloud that no longer permits unix programs to make changes to `/tmp`. The test relied to this for no good reason; the updated version creates a dedicated folder /home/ec2-user/repro to perform the check. Fixes https://github.com/pulumi/pulumi-aws/issues/4670 --- .../imds-auth/imds-v2/Pulumi.yaml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/provider/test-programs/imds-auth/imds-v2/Pulumi.yaml b/provider/test-programs/imds-auth/imds-v2/Pulumi.yaml index c5be8cfb2d8..bc119d7277f 100644 --- a/provider/test-programs/imds-auth/imds-v2/Pulumi.yaml +++ b/provider/test-programs/imds-auth/imds-v2/Pulumi.yaml @@ -94,7 +94,7 @@ resources: bucket: ${upload-bucket.id} key: pulumi-resource-aws source: - fn::FileAsset: ${localProviderBuild} + fn::fileAsset: ${localProviderBuild} my-instance-profile: type: aws:iam/instanceProfile:InstanceProfile @@ -167,14 +167,19 @@ resources: type: command:remote:Command properties: create: | - cd /tmp + # Install pulumi and pulumi-resource-aws into PATH + export PATH="/home/ec2-user/.pulumi/bin:$PATH" + cp /tmp/pulumi-resource-aws /home/ec2-user/.pulumi/bin/ + chmod a+x /home/ec2-user/.pulumi/bin/pulumi-resource-aws + echo "pulumi version:" + pulumi version + echo "pulumi-resource-aws version:" + pulumi-resource-aws -version + mkdir /home/ec2-user/repro + cp /tmp/Pulumi.yaml /home/ec2-user/repro/Pulumi.yaml + cd /home/ec2-user/repro mkdir ./pulumi-state export PULUMI_CONFIG_PASSPHRASE=123456 - export PATH="/tmp:$PATH" - export PATH="/home/ec2-user/.pulumi/bin:$PATH" - chmod a+x /tmp/pulumi-resource-aws - pulumi version # ensure in PATH - pulumi-resource-aws --help # ensure in PATH pulumi stack init dev pulumi stack select dev pulumi config