hashicorp / packer-plugin-alicloud

Packer plugin for Alibaba Cloud Image Builder
https://www.packer.io/docs/builders/alicloud-ecs
Mozilla Public License 2.0
12 stars 21 forks source link

fix confused parameter ram_role_name to ecs_ram_role_name #105

Closed alexyueer closed 1 year ago

alexyueer commented 1 year ago

fix confused parameter ram_role_name which works for credential and launching instance. ram_role_name will only work for credential. ecs_ram_role_name will only work for launching instance.

codeloversa commented 1 year ago

@alexyueer @lbajolet-hashicorp I believe this change is necessary. With v1.0.6 our CI pipeline is having a hard time to authenticate to alicloud via ram. And it's good before

lbajolet-hashicorp commented 1 year ago

Hi everyone,

Re-reading through this code, I think I understand what you are trying to do better now @alexyueer.

What's happening is that the second definition of the ram_role_name gets shadowed at generation-time by packer-sdc, so only the first processed definition (AlicloudAccessConfig.AlicloudRamRole) gets injected in the resulting flattened configuration, making it impossible to set RunConfig.RamRoleName independently from the AlicloudAccessConfig.AlicloudRamRole, setting one will also set the other.

To fix this issue unfortunately, this will require a breaking change such as the one you are proposing. Therefore, I will merge your PR, and open another subsequent one to fix the remaining conflicts there are in the config for this plugin.

We'll release a new version of the plugin when the SDK's packer-sdc command is updated so we have a way to prevent such problems in the future.

Thanks for bringing this problem to our attention, and sorry I misunderstood your fix originally.