Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ReinstallInstanceRequest instead of NewReinstallInstanceRequestWithDefaults #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

m0build-io
Copy link

@m0build-io m0build-io commented Dec 30, 2024

This commit fix the issue where the default_user would be reset to admin on reinstallation independently from the value set in terrafom see issue #45.
The problem is that the NewReinstallInstanceRequestWithDefaults return a ReinstallInstanceRequest with a DefaultUser value of "admin". Because of this, on reinstallation, the default_user would unexpectedly be set to admin.

For example:

  1. Define a contabo_resource with debian 10 and default_user=root using contabo Web UI (I don't use terraform here to not raise the issue immediately

  2. Check using cntb that it is installed correctly

cntb get instances --oauth2-clientid="" --oauth2-client-secret="" --oauth2-user="" --oauth2-password=""
INSTANCEID  NAME          DISPLAYNAME   STATUS     IMAGEID                               REGION  PRODUCTID  IPV4     IPV6                                     DEFAULTUSER
123456789   vmi123456789  display_name  installing bcaaa769-2a1d-4b54-b93b-e329360457e1  EU      V1         1.2.3.4  1234:1234:1234:1234:0000:0000:0000:0001  root
  1. Once installed. Trigger a reinstallation using terrafom without changing the default_user, only changing the image:
resource "contabo_instance" "instance" {
        default_user = "root"
        image_id = "4efbc0ba-2313-4fe1-842a-516f8652e729"
}
  1. Check using cntb, the default_user has been reset to "admin" :(
INSTANCEID  NAME          DISPLAYNAME    STATUS     IMAGEID                               REGION  PRODUCTID  IPV4     IPV6                                     DEFAULTUSER
123456789   vmi123456789  display_name   installing 4efbc0ba-2313-4fe1-842a-516f8652e729  EU      V1         1.2.3.4  1234:1234:1234:1234:0000:0000:0000:0001  admin

…thDefaults

This commit fix the issue where the default_user would be reset to admin
on reinstallation independently from the value set in terrafom
@m0build-io m0build-io force-pushed the fix_default_user_admin branch from 06582ae to 95cbad8 Compare December 30, 2024 03:02
@m0build-io m0build-io changed the title set patchInstanceRequest.DefaultUser to an empty string use ReinstallInstanceRequest instead of NewReinstallInstanceRequestWithDefaults Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant