nix-community / terraform-nixos

A set of Terraform modules that are designed to deploy NixOS [maintainer=@adrian-gierakowski]
Apache License 2.0
333 stars 61 forks source link

Google Cloud services fail to start #59

Open robbins opened 3 years ago

robbins commented 3 years ago

Describe the bug After running terraform apply, I receive this error message: https://defuse.ca/b/QnVKBcVO I'm pointing out that I enabled build_on_target true in case that's relevant, as I was facing invalid signatures for one of the packages mentioned here:

error: cannot add path '/nix/store/0km4ablsx26i1755jq4vq49d21q7p5vp-unit-google-clock-skew-daemon.service' because it lacks a valid signature

To Reproduce Relevant snippet of main.tf:

module "nixos_image_1809" {
  source = "github.com/tweag/terraform-nixos/google_image_nixos"
  nixos_version = "latest"
}

module "deploy_nixos" {
    source = "git::https://github.com/tweag/terraform-nixos.git//deploy_nixos?ref=646cacb12439ca477c05315a7bfd49e9832bc4e3"
    nixos_config = "${path.module}/configuration.nix"
    target_host = google_compute_instance.example.network_interface.0.access_config.0.nat_ip 
    target_user = "USER_NAME"
    ssh_agent = false
    ssh_private_key_file = "/home/USER/.ssh/SSHKEY"
    build_on_target = "true"
}

resource "google_compute_instance" "example" {
  name         = "example"
  machine_type = "e2-micro"

  boot_disk {
    initialize_params {
      image = module.nixos_image_1809.self_link
      size = 30
    }
  }

  network_interface {
    network       = "default"
    access_config {
    }
  }

  metadata = {
    enable-oslogin = "TRUE"
  }

and configuration.nix is the default setup:

{ modulesPath, ... }:
{
  imports = [
    "${toString modulesPath}/virtualisation/google-compute-image.nix"
  ];
}

I've just ran terraform init, and terraform apply.

Expected behavior I expected the deployment to complete successfully.

Environment

Additional context Add any other context about the problem here.