I have a gcloud db which I’m trying to add the ed...
# python
t
I have a gcloud db which I’m trying to add the edition keyword. When I run pulumi up, I get an error:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (tonocracy-backend-etest):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/devops/__main__.py", line 206, in <module>
        settings=sql.DatabaseInstanceSettingsArgs(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: DatabaseInstanceSettingsArgs.__init__() got an unexpected keyword argument 'edition'
The IDE is happy with this and it matches the code created by pulumi new.
Copy code
class DatabaseInstanceSettingsArgs:
    def __init__(__self__, *,
                 tier: pulumi.Input[str],
                 activation_policy: Optional[pulumi.Input[str]] = None,
                 active_directory_config: Optional[pulumi.Input['DatabaseInstanceSettingsActiveDirectoryConfigArgs']] = None,
                 advanced_machine_features: Optional[pulumi.Input['DatabaseInstanceSettingsAdvancedMachineFeaturesArgs']] = None,
                 availability_type: Optional[pulumi.Input[str]] = None,
                 backup_configuration: Optional[pulumi.Input['DatabaseInstanceSettingsBackupConfigurationArgs']] = None,
                 collation: Optional[pulumi.Input[str]] = None,
                 connector_enforcement: Optional[pulumi.Input[str]] = None,
                 data_cache_config: Optional[pulumi.Input['DatabaseInstanceSettingsDataCacheConfigArgs']] = None,
                 database_flags: Optional[pulumi.Input[Sequence[pulumi.Input['DatabaseInstanceSettingsDatabaseFlagArgs']]]] = None,
                 deletion_protection_enabled: Optional[pulumi.Input[bool]] = None,
                 deny_maintenance_period: Optional[pulumi.Input['DatabaseInstanceSettingsDenyMaintenancePeriodArgs']] = None,
                 disk_autoresize: Optional[pulumi.Input[bool]] = None,
                 disk_autoresize_limit: Optional[pulumi.Input[int]] = None,
                 disk_size: Optional[pulumi.Input[int]] = None,
                 disk_type: Optional[pulumi.Input[str]] = None,
                 edition: Optional[pulumi.Input[str]] = None,  #### HERE
                 insights_config: Optional[pulumi.Input['DatabaseInstanceSettingsInsightsConfigArgs']] = None,
                 ip_configuration: Optional[pulumi.Input['DatabaseInstanceSettingsIpConfigurationArgs']] = None,
                 location_preference: Optional[pulumi.Input['DatabaseInstanceSettingsLocationPreferenceArgs']] = None,
                 maintenance_window: Optional[pulumi.Input['DatabaseInstanceSettingsMaintenanceWindowArgs']] = None,
                 password_validation_policy: Optional[pulumi.Input['DatabaseInstanceSettingsPasswordValidationPolicyArgs']] = None,
                 pricing_plan: Optional[pulumi.Input[str]] = None,
                 sql_server_audit_config: Optional[pulumi.Input['DatabaseInstanceSettingsSqlServerAuditConfigArgs']] = None,
                 time_zone: Optional[pulumi.Input[str]] = None,
                 user_labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 version: Optional[pulumi.Input[int]] = None):
Is there a silly mistake I’m making, or is the
pulumi
command not in sync with the code in the project or ….?
a
It sounds like a version issue. Which version of
pulumi_gcp
do you have installed (in your
venv
by default)?
t
pulumi_gcp-6.61.1.dist-info/ is in the venv that is enabled on my command line (and for the IDE) pulumi_gcp-6.59.0.dist-info/ is in the venv that is in the pulumi “project” directory … which I assume is what the pulumi binary uses.
Does Pulumi have a method/documentation to update the “project venv”?
@ancient-policeman-24615 ^^^^
a
I’m not aware of any pulumi specific way to manage installed python dependencies. You should be able to do whatever you would normally do to resolve this problem. I would run
./venv/bin/pip uninstall pulumi_gcp && ./venv/bin/pip install -r requirements.txt
, though Python experts might have a cleaner solution.
t
This is one area that Terraform beats Pulumi. 😞
Also, the requirements.txt file is not updated. Please add a feature that refreshes the project just like you can create a new one. Is this in Pulumi’s backlog?
d
You should set the IDE to use the same venv as pulumi. With vscode, you can add the folder to your workspace which allows for multiple python venvs. Jetbrains has similar functionality. While it's not built into pulumi, you can use a tool like
pur
to automate updating the requirements file: https://pypi.org/project/pur/
If you know you'll always run pulumi from inside a venv (ie, you activate it yourself), then you can remove the venv setting from
Pulumi.yaml
and the requirements.txt file. However I'd only recommend this if you have a way of managing the dependencies for the venv already