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

ibm_is_ssh_key changes not being reflected #38

Open
jandroav opened this issue Mar 16, 2023 · 0 comments
Open

ibm_is_ssh_key changes not being reflected #38

jandroav opened this issue Mar 16, 2023 · 0 comments

Comments

@jandroav
Copy link

Hello.
I am using the code from terraform-single and we saw that newly added ssh keys are not being used by existing ibm_is_instance resources. i.e:

variable "ssh_public_keys" {
  type = map(string)
  default = {
    user1   = "SAMPLE_SSH_PUBLIC_KEY1",
    user2   = "SAMPLE_SSH_PUBLIC_KEY2",
    user3   = "SAMPLE_SSH_PUBLIC_KEY3",
    user4 = "SAMPLE_SSH_PUBLIC_KEY4"
  }
}

resource "ibm_is_ssh_key" "sshkey" {
  for_each   = var.ssh_public_keys
  name       = each.key
  public_key = each.value
}

resource "ibm_is_instance" "testacc_vsi" {
  name = "db2z1"
  #image   = local.image.id
  image   = "r038-043c2fc5-0baf-4825-916b-63f4755acc30"
  profile = local.profile

  primary_network_interface {
    subnet          = ibm_is_subnet.testacc_subnet.id
    security_groups = [ibm_is_security_group.testacc_security_group.id]
  }

  vpc  = ibm_is_vpc.testacc_vpc.id
  zone = "${var.region}-${var.zone}"
  keys = values(ibm_is_ssh_key.sshkey)[*].id
}

If an ibm_is_instance is created and then we add a new ssh key to the variable above, we can see the key created in the IBM Cloud UI but not being used by the virtual server. We need to recreate the instance every time we add a new public key.

Is there any workaround to avoid destroying the existing instances?

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

No branches or pull requests

1 participant