Skip to content

The synced_folder option does not expand ~/ #68

@smaruy30

Description

@smaruy30

Overview of the Issue

The synced_folder option does not expand ~/

Reproduction Steps

Set synced_folder as ~/.aws then execute packer build .

Plugin and Packer version

pakcer version v1.8.3

Simplified Packer Buildfile

packer {
  required_plugins {
    amazon = {
      version = ">= 1.1.0"
      source  = "github.com/hashicorp/amazon"
    }
    vagrant = {
      version = ">= 1.0.3"
      source  = "github.com/hashicorp/vagrant"
    }
  }
}

source "vagrant" "this" {
  add_force    = true
  communicator = "ssh"
  source_path  = "stakahashi/amazonlinux2"
  provider     = "virtualbox"
  synced_folder = "~/.aws/"
  #synced_folder = "$HOME/.aws/"
}

build {
  name    = "build_vagrant"
  sources = ["source.vagrant.this"]

  provisioner "shell" {
    environment_vars = [
      "AWS_CONFIG_FILE=/vagrant/config",
      "AWS_DEFAULT_REGION=${var.aws_region}",
      "AWS_PROFILE=${var.aws_profile}",
      "AWS_SHARED_CREDENTIALS_FILE=/vagrant/credentials"
    ]
    inline = [
      "aws sts get-caller-identity"
    ]
  }
}

Operating system and Environment details

MacOS Catalina, Intel Core i7

Log Fragments and crash.log files

$ packer build test.pkr.hcl
Error: 1 error(s) occurred:

* synced_folder "/path/to/the/packer/directory/~/.aws" does not exist on the Packer host.

  on test.pkr.hcl line 151:
  (source code not available)



==> Wait completed after 4 microseconds

==> Builds finished but no artifacts were created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions