Search code examples
terraformcoreosignition

Ignition fails because group already exists


I'm trying to create a user and group with Terraform but when I run the instance via CoreOS it fails with the error:

[  298.037882] ignition[2052]: files: createGroups: op(1): [failed]   adding group "vault": exit status 9: Cmd: "/usr/sbin/groupadd" "--root" "/sysroot" "--gid" "1001" "--password" "*" "vault" Stdout: "" Stderr: "groupadd: group 'vault' already exists\n"
[

The HCL is the following:

data "ignition_group" "vault" {
  name = "vault"
  gid  = 1001
}

data "ignition_user" "vault" {
  name = "vault"

  shell          = "/bin/false"
  no_create_home = false
  uid            = 1000
  system         = true

  no_user_group = true
  primary_group = data.ignition_group.vault.gid
}

Anything wrong here?


Solution

  • This failed because there was already an existing user with the same uid but different name and in Linux, it matters the ID not the name