I realize that the name 'Linux Provider' is misleading, but I needed this provider and couldn't find a more suitable name.
provider "linux" {
host = "192.168.1.2"
user = "user"
}
Clone repository to: $GOPATH/src/github.com/mavidser/terraform-provider-linux
$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers
$ git clone git@github.com:mavidser/terraform-provider-linux
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/mavidser/terraform-provider-linux
$ make build
Sample configuration for creating a few users/groups:
resource "linux_group" "testgroup" {
name = "testgroup"
system = false
}
resource "linux_user" "testuser1" {
name = "testuser1"
gid = linux_group.testgroup.gid
system = false
}
resource "linux_user" "testuser2" {
name = "testuser2"
gid = linux_group.testgroup.gid
system = false
}
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.11+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin
to your $PATH
.
To compile the provider, run make build
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
$ make build
...
$ $GOPATH/bin/terraform-provider-linux
...
In order to test the provider, you can simply run make test
.
Note: These tests will require docker installed to spin up a container with ssh access.
$ make test
In order to run the full suite of Acceptance tests, run make testacc
.
$ make testacc
In order to run only single Acceptance tests, execute the following steps:
# setup the testing environment
$ source ./scripts/tests_setup.sh
# run single tests
TF_LOG=INFO TF_ACC=1 go test -v ./linux -run TestAccUserCreation -timeout 360s
# cleanup the local testing resources
$ source ./scripts/tests_cleanup.sh