example usage files
This commit is contained in:
parent
2981325cbf
commit
dace8b00e4
|
@ -0,0 +1,6 @@
|
||||||
|
provider_installation {
|
||||||
|
filesystem_mirror {
|
||||||
|
path = "../../repo/"
|
||||||
|
include = ["registry.terraform.io/dpedu/*"]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
system = {
|
||||||
|
version = "~> 0.0.1"
|
||||||
|
source = "dpedu/system"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provider "system" {
|
||||||
|
connection_string = "ssh://root@core00?agent=yes"
|
||||||
|
// connection_string = "ssh://dave:password@core00"
|
||||||
|
// connection_string = "ssh://root@core00?ssh_key_path=~/.ssh/id_rsa"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# creates a directory
|
||||||
|
resource "system_dir" "confdir" {
|
||||||
|
path = "/srv/myapp"
|
||||||
|
mode = "0755"
|
||||||
|
owner = "root"
|
||||||
|
group = "root"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
output "test" {
|
||||||
|
value = system_dir.confdir
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# creates a file
|
||||||
|
resource "system_file" "conffile" {
|
||||||
|
path = "${system_dir.confdir.path}/config.txt"
|
||||||
|
mode = "0644"
|
||||||
|
owner = "root"
|
||||||
|
group = "root"
|
||||||
|
content = <<EOF
|
||||||
|
lolol
|
||||||
|
lolol
|
||||||
|
lolol
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
# run a command once and store in the terraform state a boolean indicating that it has been ran
|
||||||
|
resource "system_exec" "install" {
|
||||||
|
command = "apt-get install -y myapp"
|
||||||
|
|
||||||
|
depends_on = [
|
||||||
|
system_file.conffile
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
output "install_log" {
|
||||||
|
value = system_exec.install.output
|
||||||
|
}*/
|
Loading…
Reference in New Issue