pulumi / pulumi-openstack

An OpenStack Pulumi resource package, providing multi-language access to OpenStack
Apache License 2.0
56 stars 8 forks source link

pulumi returns a warning: floating_ip is deprecated: Use the openstack_compute_floatingip_associate_v2 - but there is none #353

Open oallart opened 1 year ago

oallart commented 1 year ago

What happened?

Up until a few weeks ago, running pulumi python code to attach a floating IP was working without such a warning

warning: floating_ip is deprecated: Use the openstack_compute_floatingip_associate_v2 resource instead

Pulumi does not provide a openstack_compute_floatingip_associate_v2

Terraform does: https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/resources/compute_floatingip_associate_v2

Pulumi only has a https://www.pulumi.com/registry/packages/openstack/api-docs/networking/floatingipassociate/

Expected Behavior

No warning. networking.FloatingIpAssociatev2 should be implemented, matching Terraform's

Steps to reproduce

create a net, subnet, port, attach a floating IP with FloatingIpAssociate The code works but a warnign is produced

Output of pulumi about

$ pulumi about
CLI
Version      3.77.1
Go Version   go1.20.6
Go Compiler  gc

Plugins
NAME       VERSION
openstack  3.13.0
python     unknown

Host
OS       ubuntu
Version  20.04
Arch     x86_64

This project is written in python: executable='/usr/bin/python3' version='3.8.10
'

Current Stack: organization/[redacted]

TYPE                                                          URN
pulumi:pulumi:Stack                                           urn:pulumi:[redacted]::pulumi:pulumi:Stack::
pulumi:providers:openstack                                    urn:pulumi:[redacted]::pulumi:providers:openstack::default
pulumi:providers:openstack                                    urn:pulumi:[redacted]::pulumi:providers:openstack::default_3_13_0
openstack:networking/router:Router                            urn:pulumi:[redacted]::openstack:networking/router:Router::
openstack:networking/network:Network                          urn:pulumi:[redacted]::openstack:networking/network:Network::
openstack:networking/secGroup:SecGroup                        urn:pulumi:[redacted]::openstack:networking/secGroup:SecGroup::
openstack:blockstorage/volume:Volume                          urn:pulumi:[redacted]::openstack:blockstorage/volume:Volume::
openstack:networking/subnet:Subnet                            urn:pulumi:[redacted]::openstack:networking/subnet:Subnet::
openstack:networking/secGroupRule:SecGroupRule                urn:pulumi:[redacted]::openstack:networking/secGroupRule:SecGroupRule::ingress-icmp
openstack:networking/port:Port                                urn:pulumi:[redacted]::openstack:networking/port:Port::
openstack:networking/secGroupRule:SecGroupRule                urn:pulumi:[redacted]::openstack:networking/secGroupRule:SecGroupRule::ingress-ssh-any
openstack:networking/routerInterface:RouterInterface          urn:pulumi:[redacted]::openstack:networking/routerInterface:RouterInterface::
openstack:networking/floatingIpAssociate:FloatingIpAssociate  urn:pulumi:[redacted]::openstack:networking/floatingIpAssociate:FloatingIpAssociate::
openstack:compute/instance:Instance                           urn:pulumi:[redacted]::openstack:compute/instance:Instance::
openstack:compute/volumeAttach:VolumeAttach                   urn:pulumi:[redacted]::openstack:compute/volumeAttach:VolumeAttach::

Found no pending operations associated with .

Backend
Name           [redacted]
URL
User
Organizations

Dependencies:
NAME              VERSION
pip               23.2.1
pkg_resources     0.0.0
pulumi-openstack  3.13.0
setuptools        68.0.0
wheel             0.41.0

Additional context

No response

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

rquitales commented 1 year ago

Hello @oallart,

Thanks for bringing up this issue. It appears that the upstream Terraform openstack_compute_floatingip_associate_v2 resource is already supported in our provider. In fact, this resource is currently mapped to resource you linked,openstack.networking.FloatingIpAssociate, in our codebase, as can be seen here: resources.go Lines 162C5-162C46.

It's clear that the deprecation message can lead confusion among users, particularly due to the resource names not aligning with those used in our Pulumi Openstack provider. To address this issue and improve the messaging, we will work on updating the deprecation message to reflect the correct resource names in our provider.

Thanks for bringing this up!

oallart commented 1 year ago

Thanks for the reply @rquitales Ok so it IS implemented, I was afraid that my code would eventually be breaking if the depreciation was enforced instead of just warned about. Thanks for considering this. I fail to understand why the warning exists if the code is already using V2 ... "openstack_compute_floatingip_associate_v2": {Tok: openstackResource(computeMod, "FloatingIpAssociate")},

oallart commented 1 year ago

Do we have an update on this? I still see warnings

FullOfSplendor commented 1 year ago

I fail to understand why the warning exists if the code is already using V2 ... "openstack_compute_floatingip_associate_v2": {Tok: openstackResource(computeMod, "FloatingIpAssociate")},

I think it's a warning on pulumi_openstack.compute.Instance and not pulumi_openstack.networking.FloatingIpAssociate.

See https://www.pulumi.com/registry/packages/openstack/api-docs/compute/instance/#floating_ip_python

Even if you don't specify a floating_ip value on your Instance object, "something" is still getting passed and triggering the deprecation warning.

Happy to be proven wrong though!

FullOfSplendor commented 1 year ago

@oallart As a workaround, you can use InterfaceAttach to attach the Port to your Instance, and specify network_mode as "none" on your Instance object.

This works for my use case, but may not be applicable to yours.

hellt commented 10 months ago

I have the same experience as @FullOfSplendor

I have the following:

inst = compute.Instance(
            name,
            compute.InstanceArgs(
                flavor_name="ea.008-0024",
                image_name="nesc-baseimages-debian-11-latest",
                key_pair="rdodin",
                networks=[compute.InstanceNetworkArgs(name=network.name)],
                floating_ip=None,
            ),
            pulumi.ResourceOptions(depends_on=[network, subnet]),
            floating_ip=None, # I even set it to None explicitly
        )

While I am not touching floating_ip on the compute resource, the warning is still emitted. Even when setting it explicitly to None...