Skip to content

Commit 04e9999

Browse files
committed
add documentation
1 parent e335c24 commit 04e9999

File tree

13 files changed

+294
-14
lines changed

13 files changed

+294
-14
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
![Release](https://img.shields.io/github/release/bmatcuk/terraform-provider-vagrant.svg?branch=master)
2-
[![Build Status](https://travis-ci.com/bmatcuk/terraform-provider-vagrant.svg?branch=master)](https://travis-ci.com/bmatcuk/terraform-provider-vagrant)
2+
[![Build Status](https://github.com/bmatcuk/terraform-provider-vagrant/actions/workflows/release.yml/badge.svg)](https://github.com/bmatcuk/terraform-provider-vagrant/actions/workflows/release.yml)
33
[![Go Report Card](https://goreportcard.com/badge/github.com/bmatcuk/terraform-provider-vagrant)](https://goreportcard.com/report/github.com/bmatcuk/terraform-provider-vagrant)
44

55
# terraform-provider-vagrant
66
A Vagrant provider for terraform.
77

8+
A note about lippertmarkus/vagrant in the registry: when I originally wrote
9+
this provider, the terraform registry didn't exist. My terraform needs waned
10+
and I didn't hear about the registry until some time later. lippertmarkus
11+
forked my provider and published to the registry as a convenience. Thanks! But,
12+
it's just an older version of this exact same codebase. So, I recommend you use
13+
bmatcuk/vagrant to get the latest updates instead.
14+
815
## Installation
9-
Download [the latest release] for your appropriate OS and architecture and
10-
extract the archive. Then copy the binary to [the terraform plugin directory].
16+
Add bmatcuk/vagrant to [required_providers]:
17+
18+
```hcl
19+
terraform {
20+
required_providers {
21+
vagrant = {
22+
source = "bmatcuk/vagrant"
23+
version = "~> 3.0.0"
24+
}
25+
}
26+
}
27+
```
1128

1229
## Usage
1330
```hcl
@@ -96,5 +113,4 @@ env TF_LOG=TRACE terraform apply ...
96113

97114
And, of course, you can always run vagrant on your Vagrantfile directly.
98115

99-
[the latest release]: https://github.com/bmatcuk/terraform-provider-vagrant/releases/latest
100-
[the terraform plugin directory]: https://www.terraform.io/docs/configuration/providers.html#third-party-plugins
116+
[required_providers]: https://www.terraform.io/docs/language/providers/requirements.html#requiring-providers

docs/index.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
page_title: "Provider: Vagrant"
3+
description: |-
4+
Integrate vagrant into terraform.
5+
---
6+
7+
# Vagrant Provider
8+
A Vagrant provider for terraform.
9+
10+
A note about lippertmarkus/vagrant in the registry: when I originally wrote
11+
this provider, the terraform registry didn't exist. My terraform needs waned
12+
and I didn't hear about the registry until some time later. lippertmarkus
13+
forked my provider and published to the registry as a convenience. Thanks! But,
14+
it's just an older version of this exact same codebase. So, I recommend you use
15+
bmatcuk/vagrant to get the latest updates instead.
16+
17+
## Installation
18+
Add bmatcuk/vagrant to [required_providers](https://www.terraform.io/docs/language/providers/requirements.html#requiring-providers):
19+
20+
```terraform
21+
terraform {
22+
required_providers {
23+
vagrant = {
24+
source = "bmatcuk/vagrant"
25+
version = "~> 3.0.0"
26+
}
27+
}
28+
}
29+
```
30+
31+
## Example Usage
32+
33+
```terraform
34+
provider "vagrant" {
35+
# no config
36+
}
37+
```
38+
39+
<!-- schema generated by tfplugindocs -->
40+
## Schema
41+
42+
## Debugging
43+
If terrafrom is failing on the vagrant step, you can get additional output by
44+
running terraform with logging output enabled. Try something like:
45+
46+
```bash
47+
env TF_LOG=TRACE terraform apply ...
48+
```
49+
50+
And, of course, you can always run vagrant on your Vagrantfile directly.

docs/resources/vm.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
page_title: "vagrant_vm Resource - terraform-provider-vagrant"
3+
description: |-
4+
Integrate vagrant into terraform.
5+
---
6+
7+
# vagrant_vm (Resource)
8+
9+
## Forcing an Update
10+
The easiest way to force an update is to set, or change the value of, some
11+
environment variable. This will signal to terraform that the vagrant_vm
12+
resource needs to update.
13+
14+
In the example below, a environment variable, `VAGRANTFILE_HASH`, is set to
15+
the md5 hash of the Vagrantfile. When the file changes, the hash will change,
16+
and terraform will ask for an update.
17+
18+
## Example Usage
19+
20+
```terraform
21+
resource "vagrant_vm" "my_vagrant_vm" {
22+
env = {
23+
# force terraform to re-run vagrant if the Vagrantfile changes
24+
VAGRANTFILE_HASH = "${md5(file("path/to/Vagrantfile"))}",
25+
}
26+
# see schema for additional options
27+
}
28+
```
29+
30+
<!-- schema generated by tfplugindocs -->
31+
## Schema
32+
33+
### Optional
34+
35+
- **env** (Map of String) Environment variables to pass to the Vagrantfile.
36+
- **id** (String) The ID of this resource.
37+
- **vagrantfile_dir** (String) Path to the directory where the Vagrantfile can be found. Defaults to the current directory.
38+
39+
### Read-Only
40+
41+
- **machine_names** (List of String) Names of the vagrant machines from the Vagrantfile. Names are in the same order as ssh_config.
42+
- **ssh_config** (List of Object) SSH connection information. (see [below for nested schema](#nestedatt--ssh_config))
43+
44+
<a id="nestedatt--ssh_config"></a>
45+
### Nested Schema for `ssh_config`
46+
47+
Read-Only:
48+
49+
- **agent** (String)
50+
- **host** (String)
51+
- **port** (String)
52+
- **private_key** (String)
53+
- **type** (String)
54+
- **user** (String)

example.tf

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/provider/provider.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
provider "vagrant" {
2+
# no config
3+
}
File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "vagrant_vm" "my_vagrant_vm" {
2+
env = {
3+
# force terraform to re-run vagrant if the Vagrantfile changes
4+
VAGRANTFILE_HASH = "${md5(file("path/to/Vagrantfile"))}",
5+
}
6+
# see schema for additional options
7+
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/bmatcuk/terraform-provider-vagrant
33
require (
44
github.com/bmatcuk/go-vagrant v1.4.2
55
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
6+
github.com/hashicorp/terraform-plugin-docs v0.4.0 // indirect
67
github.com/hashicorp/terraform-plugin-sdk v1.0.0
78
)
89

0 commit comments

Comments
 (0)