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

Warn on overlapping configurations with sub resource #1790

Open
neuni opened this issue Jan 27, 2022 · 1 comment
Open

Warn on overlapping configurations with sub resource #1790

neuni opened this issue Jan 27, 2022 · 1 comment
Labels
kind/enhancement Improvements or new features

Comments

@neuni
Copy link

neuni commented Jan 27, 2022

Hello!

  • 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)

Issue details

EC2 instance defined with following code:

const server = new aws.ec2.Instance("myServer", {
  ami: ubuntu.then(ubuntu => ubuntu.id),
  instanceType: "c5.xlarge",
  tags: {
    Name: "myServer",
  },
  associatePublicIpAddress: false,
  ebsBlockDevices: [
    {
      deleteOnTermination: false,
      deviceName: '/dev/sda1',
      volumeSize: 100,
      volumeType: 'gp3'
    }
  ],
  keyName: myServerKey.keyName,
  monitoring: true,
  vpcSecurityGroupIds: [
    securityGroup.id
  ],
  userData: '',
  subnetId: privateSubnetA.id
}, {
  dependsOn: [
    launchTemplate,
    securityGroup,
    myServerKey
  ]
});

Instance get replaced on every pulumi up because of diff:
+- └─ aws:ec2:Instance myServer replace [diff: ~ebsBlockDevices]

Details:

  ~ ebsBlockDevices: [
      ~ [0]: {
              + deleteOnTermination: false
              ~ deviceName         : "/dev/sda1" => "/dev/sda1"
              + volumeSize         : 100
              + volumeType         : "gp3"
            }
    ]

Steps to reproduce

  1. Create EC2 instance and define EBS block device
  2. run pulumi up several times

Expected: Instance is not replaced because deviceName did not change
Actual: Instance gets replaced every time

@mikhailshilkov mikhailshilkov transferred this issue from pulumi/pulumi Jan 27, 2022
@neuni
Copy link
Author

neuni commented Jan 27, 2022

Seems like it's caused by defining "ebsBlockDevices" in "aws.ec2.Instance", but also defining it in the used LaunchTemplate.
After removing the definition from the Instance, it works as expected.
Same issue with Route Tables and Routes:
Adding "routes:[]" to a RouteTable and defining the Routes separately, causes changes on every "pulumi reload" / "pulumi up".

Imho it should raise a warning if I define sub-resources using an array in the higher level resource and defining sub-resources separately at the same time.

@viveklak viveklak added the kind/enhancement Improvements or new features label Feb 2, 2022
@viveklak viveklak changed the title aws:ec2:Instance gets replaced on every update because of falsely diff in block device name Warn on overlapping configurations with sub resource Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

2 participants