pulumi / pulumi-hcloud

A Hetzner Cloud Pulumi resource package, providing multi-language access to Hetzner Cloud
Apache License 2.0
55 stars 6 forks source link

Unexpected keyword argument 'lifecycle' #482

Open habibutsu opened 3 months ago

habibutsu commented 3 months ago

What happened?

In corresponding with documentation: You can avoid this by setting lifecycle.ignore_changes to [ ssh_keys ]. I am trying to pass lifecycle parameter, but following error occurs: TypeError: Server._internal_init() got an unexpected keyword argument 'lifecycle'

Example

 hcloud.Server(
    "test-server",
    name="test-server",
    server_type="cpx11",
    image="test-image",
    location=config.require("location"),
    ssh_keys=SSH_KEYS,
    networks=[
        hcloud.ServerNetworkArgs(
            network_id=internal_network.id,
            ip=gateway_internal_ip,
            alias_ips=[],
        ),
    ],
    lifecycle={
        "ignore_changes": ["ssh_keys"],  # Ignore changes to SSH keys
    },
)

Output of pulumi about

CLI
Version 3.113.3 Go Version go1.22.2 Go Compiler gc

Plugins KIND NAME VERSION resource aws 6.32.0 resource command 0.10.0 resource docker 4.5.2 resource hcloud 1.18.1 resource minio 0.15.2 resource postgresql 3.11.0 language python unknown resource random 4.16.0

Host
OS ubuntu Version 22.04 Arch x86_64

This project is written in python: executable='/home/habibutsu/.pyenv/shims/python3' version='3.12.2'

Current Stack: ****

TYPE URN pulumi:pulumi:Stack urn:pulumi:prod::test-project-infra::pulumi:pulumi:Stack::test-project-infra-prod pulumi:providers:aws urn:pulumi:prod::test-project-infra::pulumi:providers:aws::default_6_32_0 pulumi:providers:hcloud urn:pulumi:prod::test-project-infra::pulumi:providers:hcloud::default_1_17_0 aws:route53/zone:Zone urn:pulumi:prod::test-project-infra::aws:route53/zone:Zone::test-project-ai-zone hcloud:index/floatingIp:FloatingIp urn:pulumi:prod::test-project-infra::hcloud:index/floatingIp:FloatingIp::vpn-ip hcloud:index/network:Network urn:pulumi:prod::test-project-infra::hcloud:index/network:Network::internal hcloud:index/sshKey:SshKey urn:pulumi:prod::test-project-infra::hcloud:index/sshKey:SshKey::a.ivanov hcloud:index/sshKey:SshKey urn:pulumi:prod::test-project-infra::hcloud:index/sshKey:SshKey::interconnect hcloud:index/firewall:Firewall urn:pulumi:prod::test-project-infra::hcloud:index/firewall:Firewall::http-access hcloud:index/firewall:Firewall urn:pulumi:prod::test-project-infra::hcloud:index/firewall:Firewall::allow-http-01-challenge-for-vpn hcloud:index/firewall:Firewall urn:pulumi:prod::test-project-infra::hcloud:index/firewall:Firewall::allow-vpn hcloud:index/networkRoute:NetworkRoute urn:pulumi:prod::test-project-infra::hcloud:index/networkRoute:NetworkRoute::gateway-route-office hcloud:index/networkRoute:NetworkRoute urn:pulumi:prod::test-project-infra::hcloud:index/networkRoute:NetworkRoute::gateway-route-aws-1 hcloud:index/firewall:Firewall urn:pulumi:prod::test-project-infra::hcloud:index/firewall:Firewall::internal-access-only hcloud:index/networkRoute:NetworkRoute urn:pulumi:prod::test-project-infra::hcloud:index/networkRoute:NetworkRoute::gateway-route-aws-2 hcloud:index/networkSubnet:NetworkSubnet urn:pulumi:prod::test-project-infra::hcloud:index/networkSubnet:NetworkSubnet::internal-subnet hcloud:index/server:Server urn:pulumi:prod::test-project-infra::hcloud:index/server:Server::wireguard pulumi:providers:command urn:pulumi:prod::test-project-infra::pulumi:providers:command::default_0_9_2 hcloud:index/floatingIpAssignment:FloatingIpAssignment urn:pulumi:prod::test-project-infra::hcloud:index/floatingIpAssignment:FloatingIpAssignment::wireguard-floating-ip-assignment command:remote:CopyFile urn:pulumi:prod::test-project-infra::command:remote:CopyFile::wireguard-floating-ip command:remote:CopyFile urn:pulumi:prod::test-project-infra::command:remote:CopyFile::wireguard-backup command:remote:Command urn:pulumi:prod::test-project-infra::command:remote:Command::wireguard-network-init command:remote:Command urn:pulumi:prod::test-project-infra::command:remote:Command::wireguard-restore-backup hcloud:index/server:Server urn:pulumi:prod::test-project-infra::hcloud:index/server:Server::swarm-manager

Found no pending operations associated with prod

Backend
Name * URL s3://*** User habibutsu Organizations
Token type personal

Dependencies: NAME VERSION aiohttp 3.9.3 black 24.2.0 casdoor 1.21.0 colorama 0.4.6 dacite 1.8.1 email_validator 2.1.1 fastapi 0.109.2 GeoAlchemy2 0.14.6 geojson-pydantic 1.0.2 geopandas 0.14.3 gspread 6.0.2 httptools 0.6.1 httpx 0.27.0 ipdb 0.13.13 ipykernel 6.29.3 isort 5.13.2 joblib 1.3.0 lmdb 1.4.1 orjson 3.9.15 oslpipelines-models 1.0rc3 pendulum 3.0.0 persist-queue 0.8.1 phonenumbers 8.13.31 pip 24.0 psycopg 3.1.18 psycopg-binary 3.1.18 pulumi_aws 6.32.0 pulumi_command 0.10.0 pulumi_docker 4.5.2 pulumi_hcloud 1.18.1 pulumi_minio 0.15.2 pulumi_postgresql 3.11.0 pulumi_random 4.16.0 pycountry 23.12.11 pydantic-extra-types 2.5.0 pydantic-settings 2.2.1 PyJWT 2.8.0 python-slugify 8.0.4 python-ulid 1.1.0 retry 0.9.2 seaborn 0.13.2 sentry-sdk 1.43.0 shellingham 1.5.4 tqdm 4.66.2 twine 5.0.0 typer 0.9.0 uvicorn 0.27.1 uvloop 0.19.0 watchfiles 0.21.0 websockets 12.0 wheel 0.42.0

Pulumi locates its logs in /tmp by default

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

iwahbe commented 3 months ago

Hi @habibutsu. I'm sorry you're hitting this. Our docs are translated from the upstream provider and it looks like we had a mistranslation. Please try this instead:

  hcloud.Server(
     "test-server",
     name="test-server",
     server_type="cpx11",
     image="test-image",
     location=config.require("location"),
     ssh_keys=SSH_KEYS,
     networks=[
         hcloud.ServerNetworkArgs(
             network_id=internal_network.id,
             ip=gateway_internal_ip,
             alias_ips=[],
         ),
     ],
+     opts=pulumi.ResourceOptions(ignore_changes=["ssh_keys"]),
-     lifecycle={
-         "ignore_changes": ["ssh_keys"],  # Ignore changes to SSH keys
-     },
 )

I'll keep this issue open to tracks the docs bug.