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

Basic installation with empty aws account #4

Closed
oytunyuksel opened this issue Apr 5, 2022 · 8 comments · May be fixed by #5
Closed

Basic installation with empty aws account #4

oytunyuksel opened this issue Apr 5, 2022 · 8 comments · May be fixed by #5

Comments

@oytunyuksel
Copy link

Hi all,

I'm trying to create vpn with this module. I created fresh aws account. But i'm getting error. Version is 0.2.3

Error: Error building docker image: Error response from daemon: Cannot locate specified Dockerfile: Dockerfile

I'm using this config:

instance_type = "t2.nano" wg_group_name = "VPN" vpc_id = "MY_VPC_ID" wg_admin_email = "MY_EMAIL"

Do you have any idea?

@azatsafin
Copy link
Owner

Hi @oytunyuksel thank you for intresting in Wireguard module.
could you please provide full terraform definitions and steps to reproduce.

@oytunyuksel
Copy link
Author

oytunyuksel commented Apr 8, 2022

Hi @azatsafin,

Thank you for help in advance.

Actually, i'm using in Terragrunt. Terragrunt is running terraform in the background. The Terragrunt file is below:

terraform {
  source = "git::https://github.com/azatsafin/terraform-aws-wireguard.git//?ref=v0.2.3"
}

include {
  path = find_in_parent_folders()
}

dependency "vpc" {
  config_path = "../vpc"
}
inputs = {
  instance_type                = "t2.nano"
  wg_group_name                = "VPN"
  vpc_id                       = dependency.vpc.outputs.vpc_id
  wg_admin_email               = "MY_EMAIL"
}

And Terragrunt apply's related outputs are below:

  # module.wg_manage_image.docker_registry_image.this will be created
  + resource "docker_registry_image" "this" {
      + id                   = (known after apply)
      + insecure_skip_verify = false
      + keep_remotely        = false
      + name                 = "324245454524.dkr.ecr.eu-central-1.amazonaws.com/wireguard-vpn-service-wg-manage:e1e420b522c92f7e2657973a4426fa74bc0ee8691cebff3f2b86ed953eb62hef"
      + sha256_digest        = (known after apply)

      + build {
          + context    = "./lambdas/wg-manage-iam:b89a4e002ffe8868c2ed2059be1d2f5c4a4ed8dd3ef104cf04d64aa160344432"
          + dockerfile = "Dockerfile"
        }
    }

Plan: 14 to add, 0 to change, 0 to destroy.
module.wg_manage_image.docker_registry_image.this: Creating...
╷
│ Warning: Argument is deprecated
│ 
│   with module.cognito_auth_redirect.aws_s3_bucket_object.lambda_package,
│   on .terraform/modules/cognito_auth_redirect/main.tf line 115, in resource "aws_s3_bucket_object" "lambda_package":
│  115:   bucket        = var.s3_bucket
│ 
│ Use the aws_s3_object resource instead
│ 
│ (and 9 more similar warnings elsewhere)
╵
╷
│ Error: Error building docker image: Error response from daemon: Cannot locate specified Dockerfile: Dockerfile
│ 
│   with module.wg_manage_image.docker_registry_image.this,
│   on .terraform/modules/wg_manage_image/modules/docker-build/main.tf line 22, in resource "docker_registry_image" "this":
│   22: resource "docker_registry_image" "this" {
│ 
╵

@azatsafin azatsafin linked a pull request Apr 10, 2022 that will close this issue
@azatsafin
Copy link
Owner

@oytunyuksel could you please check your setup from specified branch. I still not sure what option is the best path.cwd or path.module , because path.cwd could lead re-creation of resource if the path will be changed due to CD/CI systems or running the same state from different computers.

@oytunyuksel
Copy link
Author

I checked and i think passed the Dockerfile finding step, but i get this error now:

Error: Error building docker image: 1: The command '/bin/sh -c yum install -y wireguard-dkms wireguard-tools' returned a non-zero code: 1
│ 
│   with module.wg_manage_image.docker_registry_image.this,
│   on .terraform/modules/wg_manage_image/modules/docker-build/main.tf line 22, in resource "docker_registry_image" "this":
│   22: resource "docker_registry_image" "this" {

It looks like related to some wireguard packages. Probably something wrong on Dockerfile.

@azatsafin
Copy link
Owner

azatsafin commented Apr 11, 2022

Just checked full deployment from the scrutch with following terragrunt definition

terraform {
  source = "git::https://github.com/azatsafin/terraform-aws-wireguard.git?ref=align_submodule_docker_image_path"
}

inputs = {
  instance_type                = "t3.nano"
  wg_group_name                = "VPN"
  wg_admin_email               = "[email protected]"
}

All works fine.
But I have to add one notice, you have to use Nitro instance types, because I had hardcoded interface name in iptables settings.
Nitro instance type has network improvments in term of speed for the same price.
So, please use: t3, c5, m5 and etc instance types.

Regading you build, please check you build machine internet connections, you could also try to build Image with debug to see why it failed.

@oytunyuksel
Copy link
Author

I'm still getting same error @azatsafin . Can it related with Apple M1? Did you test in M1 chip before? For my guess, maybe "wireguard-dkms" and "wireguard-tools" packages doesn't support M1.

@azatsafin
Copy link
Owner

I don't have any 'm1' based computer, I can test it later.
This image will be used by Lambda Function, AWS lambda currently support x86_64 and arm64 images only, so you have to build image on x86_64 based architecture chips. Or you could use https://hub.docker.com/repository/docker/azatsafin/wg-manage-iam .

@oytunyuksel
Copy link
Author

Thanks a lot @azatsafin . I will try find a solution.

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 a pull request may close this issue.

2 participants