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

Understand why TestRegress1504 does not refresh cleanly #3686

Open
t0yv0 opened this issue Mar 22, 2024 · 1 comment
Open

Understand why TestRegress1504 does not refresh cleanly #3686

t0yv0 opened this issue Mar 22, 2024 · 1 comment
Labels
area/refresh impact/reliability Something that feels unreliable or flaky kind/engineering Work that is not visible to an external user

Comments

@t0yv0
Copy link
Member

t0yv0 commented Mar 22, 2024

What happened?

Introducing a test with SkipRefresh https://github.com/pulumi/pulumi-aws/compare/t0yv0/fix-1504 because refresh has changes. This is typically benign but might be interesting to investigate. This is a LaunchTemplate resource.

Example

import * as aws from "@pulumi/aws";
const ltemplate = new aws.ec2.LaunchTemplate(
    "my-launch-template",
    {
        imageId: "ami-0c55b159cbfafe1f0",
        instanceType:"t2.micro",
        keyName: 'key1',
        tags: {"Name": 'tag2'},
        updateDefaultVersion: true,
    });

Refresh diff says no changes but if pressed for details provides some:

No resources will be modified as part of this refresh; just your stack's state will be.
 details
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:dev::aws-3686::pulumi:pulumi:Stack::aws-3686-dev]
    ~ aws:ec2/launchTemplate:LaunchTemplate: (update)
        [id=lt-047219347b109768c]
        [urn=urn:pulumi:dev::aws-3686::aws:ec2/launchTemplate:LaunchTemplate::my-launch-template]
        [provider=urn:pulumi:dev::aws-3686::pulumi:providers:aws::default_6_32_0::1866b374-0cd7-4789-8430-daadd9035888]
        --outputs:--
      + securityGroupNames               : []
      + vpcSecurityGroupIds              : []

This fails (which is also why we noticed this in ProgramTest):

pulumi refresh --expect-no-changes --yes                                                                                                 ~/bugs/aws-3686
Previewing refresh (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/anton-pulumi-corp/aws-3686/dev/previews/d5d294f9-a1c4-462b-8f5c-95a4782d45a4

     Type                       Name                Plan       Info
     pulumi:pulumi:Stack        aws-3686-dev                   
 ~   └─ aws:ec2:LaunchTemplate  my-launch-template  update     [diff: +securityGroupNames,vpcSecurityGroupIds]

Resources:
    ~ 1 to update
    1 unchanged

Refreshing (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/anton-pulumi-corp/aws-3686/dev/updates/6

     Type                       Name                Status              Info
     pulumi:pulumi:Stack        aws-3686-dev                            
 ~   └─ aws:ec2:LaunchTemplate  my-launch-template  updated (0.71s)     [diff: +securityGroupNames,vpcSecurityGroupIds]

Resources:
    ~ 1 updated
    1 unchanged

Duration: 2s

error: error: no changes were expected but changes occurred

If I do pulumi up --refresh then the program corrects itself; notably it does not show any changes.

If I do pulumi --refresh --yes this also fixes itself subsequently.

Output of pulumi about

N/A

Additional context

N/A

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Mar 22, 2024
@t0yv0 t0yv0 added area/refresh kind/engineering Work that is not visible to an external user impact/reliability Something that feels unreliable or flaky and removed needs-triage Needs attention from the triage team kind/bug Some behavior is incorrect or out of spec labels Mar 25, 2024
@t0yv0
Copy link
Member Author

t0yv0 commented Apr 24, 2024

In TF this program also has state changes upon refresh, but since TF implies refresh on apply, this quickly auto-corrects itself:

resource "aws_launch_template" "lt" {
  image_id = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"
  key_name = "key1"
  update_default_version = true
}

First state:

# aws_launch_template.lt:
resource "aws_launch_template" "lt" {
    arn                     = "arn:aws:ec2:us-east-1:616138583583:launch-template/lt-034fd5d51ac15a63c"
    default_version         = 1
    disable_api_stop        = false
    disable_api_termination = false
    id                      = "lt-034fd5d51ac15a63c"
    image_id                = "ami-0c55b159cbfafe1f0"
    instance_type           = "t2.micro"
    key_name                = "key1"
    latest_version          = 1
    name                    = "terraform-20240424222151918500000001"
    name_prefix             = "terraform-"
    tags_all                = {}
    update_default_version  = true
}

second state:

# aws_launch_template.lt:
resource "aws_launch_template" "lt" {
    arn                     = "arn:aws:ec2:us-east-1:616138583583:launch-template/lt-034fd5d51ac15a63c"
    default_version         = 1
    disable_api_stop        = false
    disable_api_termination = false
    id                      = "lt-034fd5d51ac15a63c"
    image_id                = "ami-0c55b159cbfafe1f0"
    instance_type           = "t2.micro"
    key_name                = "key1"
    latest_version          = 1
    name                    = "terraform-20240424222151918500000001"
    name_prefix             = "terraform-"
    security_group_names    = []
    tags                    = {}
    tags_all                = {}
    update_default_version  = true
    vpc_security_group_ids  = []
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/refresh impact/reliability Something that feels unreliable or flaky kind/engineering Work that is not visible to an external user
Projects
None yet
Development

No branches or pull requests

1 participant