Hi, This looks like a bug. Getting `ConflictsWith:...
# aws
b
Hi, This looks like a bug. Getting
ConflictsWith: "network_interface"
when creating instance with
source_dest_check=
Copy code
aws.ec2.Instance("romlaz_frog_1",
                  instance_type="t2.micro",
                  availability_zone="eu-west-1a",
                  root_block_device=root_block_device_,
                  ami=instance["ami"], tags=instance.get("tags", None), key_name=instance["key_name"],
                  network_interfaces=[{"device_index": 0,
                           "network_interface_id": "eni-0f74fbfd28bc...."}],
                  source_dest_check=True, # <<< same issue when False is used
                  )
Copy code
>pulumi up
Previewing update (simple):
     Type                 Name                Plan     Info
     pulumi:pulumi:Stack  aws_project-simple
     └─ aws:ec2:Instance  romlaz_frog_1                1 error

Diagnostics:
  aws:ec2:Instance (romlaz_frog_1):
    error: aws:ec2/instance:Instance resource 'romlaz_frog_1' has a problem: ConflictsWith: "network_interface": conflicts with source_dest_check. Examine values at 'Instance.NetworkInterfaces'.


warning: A new version of Pulumi is available. To upgrade from version '3.7.0' to '3.7.1'
Note that this works fine when not using
source_dest_check=
, and that default is True for that setting.
b
i believe here what is happening is that the ec2 resource allows you to specify some settings, like source_dest_check, in the case where you want a network interface created and attached to the instance. so source_dest_check is a property that will be applied to the automatically created network interface. but if you want to bring your own network interface created elsewhere to the instance, it won't generate a network interface. and that network interface already was created with its own source_dest_check=true/false. so the source_dest_check on the ec2 instance "default" is probably actually null or unset - but in the event you want to automatically create a network interface for it (by not supplying your own) it will default to true only in that case
i am more familiar with c# but you can see here that for the
InstanceArgs
class,
SourceDestCheck
is of type
Input<bool>?
meaning nullable, and is not initialized to any value so will default to null https://github.com/pulumi/pulumi-aws/blob/master/sdk/dotnet/Ec2/Instance.cs#L676 so even though the docs say "default is true", setting the value to true is different than leaving it untouched
b
ok, that sounds logical, but it is still a parameter that can be True or False, and non of them works as soon as it is used in
aws.ec2.Instance(..)
https://www.pulumi.com/docs/reference/pkg/aws/ec2/instance/#source_dest_check_python also this parameter works perfect when used in
aws.ec2.NetworkInterface(source_dest_check=False)
b
i'm less familiar with how python works, but it look like they are not just using booleans, but wrapping them in this `Optional[pulumi.Input[bool]]`: https://github.com/pulumi/pulumi-aws/blob/master/sdk/python/pulumi_aws/ec2/instance.py#L673
so i think you could set it to
true
or
false
or
None
b
@bumpy-grass-54508 thanks for explaining, I debugged this and this is how it works in Pulumi for
aws.ec2.Instance(..)
parameter
source_dest_check=
is not working (or working automagically) and then when using
aws.ec2.NetworkInterface(source_dest_check=<False or True>)
this parameter will inherit into Instance
source_dest_check=
when not using this parameter...
most of the parameters in aws.ec2... can be set to
None
b
no problem! yeah i think a lot of them can be
None
and will default to
None
, but then later on depending on other conditions the actual "default" value will come into play