みずりゅの自由帳

主に参加したイベントやソフトウェア技術/開発について記録しています

atlas.hashicorp.comからapp.vagrantup.comに変わっていたのでconfig.vm.box_urlで指定する

備忘。Vagrantのお話。

2-3年前に利用していたVMvagrant upをしたら、404のエラーがでてBoxを取得できませんでした。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/bionic64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
The box 'ubuntu/bionic64' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://atlas.hashicorp.com/ubuntu/bionic64"]
Error: The requested URL returned error: 404 Not Found

エラーメッセージが「404 Not Found」だったのでサイトが移行したのかなと思い、 https://atlas.hashicorp.com を直接叩いてみると、 https://app.terraform.io/session に遷移した。

パブリックなBoxの取得にもアカウントが必要になった?
とは思ったものの、さすがにTerraform用のアカウントが必要になるのは極端かなとも思った。
というわけで、改めてGoogle先生に質問。
こちらの記事がヒットした。

qiita.com

ふむふむ。
https://atlas.hashicorp.com のサイトは https://app.vagrantup.com に移行したんですね。
パブリックなBoxはアカウントを作らなくても取得できそう。
というわけで、Box取得先のURLを変更することにします。

Box取得先のURLを指定は、Vagrantfile内で「config.vm.box_url」で指定します。

例えば、元のVagrantfileが

  config.vm.box = "ubuntu/bionic64"

と記述していた場合には、

  config.vm.box_url = "https://app.vagrantup.com/ubuntu/bionic64"
  config.vm.box = "ubuntu/bionic64"

のように指定します。
これでBoxが取得できて、vagrant upも無事起動しました。