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

Fix updating tags on aws_launch_template #3687

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions provider/provider_python_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"

"github.com/pulumi/pulumi/pkg/v3/testing/integration"
)

Expand All @@ -30,6 +32,36 @@ func TestRegress3196(t *testing.T) {
})
}

func TestRegress1504(t *testing.T) {
if testing.Short() {
t.Skipf("Skipping test in -short mode because it needs cloud credentials")
return
}
test := getPythonBaseOptions(t).
With(integration.ProgramTestOptions{
// Not ideal, need investigation:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #3686

ExpectRefreshChanges: true,
Dir: filepath.Join("test-programs", "regress-1504", "init"),
EditDirs: []integration.EditDir{
{
Dir: filepath.Join("test-programs", "regress-1504", "step-1"),
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
assert.Equal(t, float64(1), stack.Outputs["launch_template_latest_version"])
},
Additive: true,
},
{
Dir: filepath.Join("test-programs", "regress-1504", "step-2"),
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
assert.Equal(t, float64(2), stack.Outputs["launch_template_latest_version"])
},
Additive: true,
},
},
})
integration.ProgramTest(t, &test)
}

func getPythonBaseOptions(t *testing.T) integration.ProgramTestOptions {
t.Helper()
envRegion := getEnvRegion(t)
Expand Down
4 changes: 3 additions & 1 deletion provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,9 @@ func ProviderFromMeta(metaInfo *tfbridge.MetadataInfo) *tfbridge.ProviderInfo {
shimv2.WithDiffStrategy(shimv2.PlanState),
shimv2.WithPlanResourceChange(func(s string) bool {
switch s {
case "aws_ssm_document", "aws_wafv2_web_acl":
case "aws_ssm_document",
"aws_wafv2_web_acl",
"aws_launch_template":
return true
default:
return false
Expand Down
10 changes: 10 additions & 0 deletions provider/test-programs/regress-1504/init/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: repro-1504
runtime:
name: python
options:
virtualenv: venv
description: Reproduce pulumi-aws issue 1504
config:
pulumi:tags:
value:
pulumi:template: aws-python
13 changes: 13 additions & 0 deletions provider/test-programs/regress-1504/init/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pulumi
import pulumi_aws as aws

ec2_launch_template = aws.ec2.LaunchTemplate(
"my_launch_template",
image_id="ami-0c55b159cbfafe1f0",
instance_type="t2.micro",
key_name='key1',
tags={"Name": 'tag1'},
update_default_version=True)

pulumi.export("launch_template_id", ec2_launch_template.id)
pulumi.export("launch_template_latest_version", ec2_launch_template.latest_version)
1 change: 1 addition & 0 deletions provider/test-programs/regress-1504/init/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pulumi>=3.0.0,<4.0.0
13 changes: 13 additions & 0 deletions provider/test-programs/regress-1504/step-1/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pulumi
import pulumi_aws as aws

ec2_launch_template = aws.ec2.LaunchTemplate(
"my_launch_template",
image_id="ami-0c55b159cbfafe1f0",
instance_type="t2.micro",
key_name='key1',
tags={"Name": 'tag2'},
update_default_version=True)

pulumi.export("launch_template_id", ec2_launch_template.id)
pulumi.export("launch_template_latest_version", ec2_launch_template.latest_version)
13 changes: 13 additions & 0 deletions provider/test-programs/regress-1504/step-2/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pulumi
import pulumi_aws as aws

ec2_launch_template = aws.ec2.LaunchTemplate(
"my_launch_template",
image_id="ami-0c55b159cbfafe1f0",
instance_type="t2.micro",
key_name='key2',
tags={"Name": 'tag2'},
update_default_version=True)

pulumi.export("launch_template_id", ec2_launch_template.id)
pulumi.export("launch_template_latest_version", ec2_launch_template.latest_version)
Loading