-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cd1856
commit c8aaa28
Showing
9 changed files
with
1,805 additions
and
0 deletions.
There are no files selected for viewing
375 changes: 375 additions & 0 deletions
375
...r/.terraform/providers/registry.terraform.io/hashicorp/null/3.2.3/linux_amd64/LICENSE.txt
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+13.6 MB
.../registry.terraform.io/hashicorp/null/3.2.3/linux_amd64/terraform-provider-null_v3.2.3_x5
Binary file not shown.
756 changes: 756 additions & 0 deletions
756
...orm/providers/registry.terraform.io/vultr/vultr/2.23.1/linux_amd64/CHANGELOG.md
Large diffs are not rendered by default.
Oops, something went wrong.
373 changes: 373 additions & 0 deletions
373
...m/vultr/.terraform/providers/registry.terraform.io/vultr/vultr/2.23.1/linux_amd64/LICENSE
Large diffs are not rendered by default.
Oops, something went wrong.
135 changes: 135 additions & 0 deletions
135
...raform/providers/registry.terraform.io/vultr/vultr/2.23.1/linux_amd64/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
Terraform Provider for Vultr | ||
================== | ||
|
||
- Quickstart Guide: [How to Provision a Vultr Cloud Server with Terraform and Cloud-Init](https://www.vultr.com/docs/provision-a-vultr-cloud-server-with-terraform-and-cloud-init/) | ||
- Vultr Website: https://www.vultr.com | ||
- Terraform Website: https://www.terraform.io | ||
|
||
<img src="https://raw.githubusercontent.com/hashicorp/terraform-website/master/public/img/logo-hashicorp.svg" width="600px"> | ||
|
||
Requirements | ||
------------ | ||
|
||
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x+ | ||
- [Go](https://golang.org/doc/install) 1.22.x+ (to build the provider plugin) | ||
|
||
Building The Provider | ||
--------------------- | ||
|
||
Clone repository to: `$GOPATH/src/github.com/vultr/terraform-provider-vultr` | ||
|
||
``` sh | ||
$ mkdir -p $GOPATH/src/github.com/vultr; cd $GOPATH/src/github.com/vultr | ||
$ git clone [email protected]:vultr/terraform-provider-vultr.git | ||
``` | ||
|
||
Enter the provider directory and build the provider | ||
|
||
``` sh | ||
$ cd $GOPATH/src/github.com/vultr/terraform-provider-vultr | ||
$ make build | ||
``` | ||
|
||
Using the provider | ||
---------------------- | ||
|
||
See the [Vultr Provider documentation](website/docs/index.html.markdown) to get started using the Vultr provider. | ||
|
||
Please read about [V2 changes from V1](example/V2Changes.md) for a list of new changes made to the Vultr Terraform Provider | ||
|
||
### Installation | ||
In your terraform config, define `vultr/vultr` in your `required_providers` and set your API key: | ||
``` hcl | ||
terraform { | ||
required_providers { | ||
vultr = { | ||
source = "vultr/vultr" | ||
version = "2.22.1" | ||
} | ||
} | ||
} | ||
provider "vultr" { | ||
api_key = "..." | ||
} | ||
``` | ||
|
||
After, run `terraform init` to install the provider. | ||
|
||
#### Manual Installation | ||
If you don't have internet access on the target machine or prefer to install | ||
the provider locally follow the steps for the relevant operating system and architecture. | ||
|
||
1) [Download](https://github.com/vultr/terraform-provider-vultr/releases) and | ||
extract the binary for your system and architecture | ||
|
||
2) Make the local plugins directory: | ||
|
||
On linux | ||
``` sh | ||
export VERSION=2.22.1 OS=linux ARCH=amd64 | ||
mkdir -p ~/.terraform.d/plugins/local/vultr/vultr/${VERSION}/${OS}_${ARCH}/' | ||
``` | ||
On mac | ||
``` sh | ||
export VERSION=2.22.1 OS=darwin ARCH=arm64 | ||
mkdir -p ~/.terraform.d/plugins/local/vultr/vultr/${VERSION}/${OS}_${ARCH}/' | ||
``` | ||
|
||
3) Rename and copy the binary into the local plugins directory: | ||
``` sh | ||
mv terraform-provider-vultr_v${VERSION} ~/.terraform.d/plugins/local/vultr/vultr/${VERSION}/${OS}_${ARCH}/terraform-provider-vultr_v${VERSION} | ||
``` | ||
|
||
4) Add the local provider to your terraform `main.tf` config: | ||
``` hcl | ||
terraform { | ||
required_providers { | ||
vultr = { | ||
source = "local/vultr/vultr" | ||
version = "2.22.1" | ||
} | ||
} | ||
} | ||
provider "vultr" { | ||
api_key = "..." | ||
} | ||
``` | ||
|
||
5) Test everything by running `terraform init` in that same directory. | ||
|
||
Developing the Provider | ||
--------------------------- | ||
|
||
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#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. | ||
|
||
``` sh | ||
$ make build | ||
... | ||
$ $GOPATH/bin/terraform-provider-vultr | ||
... | ||
``` | ||
|
||
In order to test the provider, you can simply run `make test`. | ||
|
||
``` sh | ||
$ make test | ||
``` | ||
|
||
In order to run the full suite of acceptance tests, run `make testacc`. | ||
|
||
*Note:* Acceptance tests create real resources, and often cost money to run. | ||
|
||
``` sh | ||
$ make testacc | ||
``` | ||
|
||
In order to run a specific acceptance test, use the `TESTARGS` environment variable. For example, the following command will run `TestAccVultrUser_base` acceptance test only: | ||
|
||
``` sh | ||
$ make testacc TESTARGS='-run=TestAccVultrUser_base' | ||
``` |
Binary file added
BIN
+17.1 MB
...ers/registry.terraform.io/vultr/vultr/2.23.1/linux_amd64/terraform-provider-vultr_v2.23.1
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#resource "vultr_instance" "enterprise" { | ||
# plan = var.vultr_instance | ||
# region = var.vultr_region | ||
# os_id = 2284 | ||
# label = var.resource_group_name_community | ||
#} | ||
|
||
resource "vultr_ssh_key" "key" { | ||
name = "vultr-ssh-key" | ||
ssh_key = file(var.publickeypath) | ||
} | ||
|
||
resource "vultr_instance" "community" { | ||
plan = var.vultr_instance | ||
region = var.vultr_region | ||
os_id = 2284 | ||
label = var.resource_group_name_community | ||
ssh_key_ids = [vultr_ssh_key.key.id] | ||
} | ||
|
||
|
||
resource "null_resource" "ams-marketplace-setup_community" { | ||
provisioner "remote-exec" { | ||
connection { | ||
type = "ssh" | ||
user = var.user | ||
host = vultr_instance.community.main_ip | ||
private_key = file(var.privatekeypath) | ||
} | ||
inline = [ | ||
"sudo sed -i 's/#\\$nrconf{kernelhints} = -1;/\\$nrconf{kernelhints} = -1;/g' /etc/needrestart/needrestart.conf", | ||
"echo 'NEEDRESTART_SUSPEND=1' >> /etc/environment", | ||
"sudo source /etc/environment", | ||
"while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1; do sleep 1; done", | ||
"while sudo fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do sleep 1; done", | ||
"sudo apt-get update -y", | ||
"sudo apt-get dist-upgrade -y", | ||
"wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh", | ||
"curl -L -o ant-media-server-community.zip https://github.com/ant-media/Ant-Media-Server/releases/download/ams-v${var.ams_version}/ant-media-server-community-${var.ams_version}.zip", | ||
"sudo bash ./install_ant-media-server.sh -i ant-media-server-community.zip", | ||
"sudo sed -i 's/server.marketplace=.*/server.marketplace=azure/g' /usr/local/antmedia/conf/red5.properties", | ||
"sudo systemctl stop antmedia", | ||
"sudo rm -rf /usr/local/antmedia/conf/instanceId", | ||
"sudo rm -rf /usr/local/antmedia/*.db.* && sudo rm -rf /usr/local/antmedia/*.db", | ||
"sudo rm -rf /root/*.zip && sudo rm -rf /root/install*", | ||
"sudo rm -rf /root/.ssh", | ||
"history -c", | ||
"sudo shutdown -h now", | ||
|
||
] | ||
} | ||
depends_on = [ | ||
vultr_instance.community | ||
] | ||
|
||
} | ||
|
||
resource "vultr_firewall_group" "my_firewall_grp" { | ||
description = "Firewall" | ||
} | ||
resource "vultr_firewall_rule" "allow_http" { | ||
firewall_group_id = vultr_firewall_group.my_firewall_grp.id | ||
protocol = "tcp" | ||
ip_type = "v4" | ||
subnet = "0.0.0.0" | ||
subnet_size = 0 | ||
port = "5080" | ||
} | ||
resource "vultr_firewall_rule" "allow_https" { | ||
firewall_group_id = vultr_firewall_group.my_firewall_grp.id | ||
protocol = "tcp" | ||
ip_type = "v4" | ||
subnet = "0.0.0.0" | ||
subnet_size = 0 | ||
port = "5443" | ||
} | ||
resource "vultr_firewall_rule" "allow_ssh" { | ||
firewall_group_id = vultr_firewall_group.my_firewall_grp.id | ||
protocol = "tcp" | ||
ip_type = "v4" | ||
subnet = "0.0.0.0" | ||
subnet_size = 0 | ||
port = "22" | ||
} | ||
|
||
resource "vultr_snapshot" "snapshot" { | ||
instance_id = resource.vultr_instance.community.id | ||
|
||
|
||
timeouts { | ||
create = "60m" | ||
} | ||
depends_on = [ | ||
null_resource.ams-marketplace-setup_community | ||
] | ||
|
||
} | ||
|
||
output "ipv4_address" { | ||
value = vultr_instance.community.main_ip | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
terraform { | ||
required_providers { | ||
vultr = { | ||
source = "vultr/vultr" | ||
version = "2.23.1" | ||
} | ||
} | ||
} | ||
|
||
# Configure the Vultr Provider | ||
provider "vultr" { | ||
api_key = var.vultr_token | ||
rate_limit = 100 | ||
retry_limit = 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
variable "vultr_token" { | ||
type = string | ||
} | ||
|
||
variable "vultr_region" { | ||
type = string | ||
default = "fra" | ||
} | ||
|
||
variable "vultr_instance" { | ||
type = string | ||
default = "vc2-2c-4gb" | ||
} | ||
|
||
variable "resource_group_name_enterprise" { | ||
default = "enterprise" | ||
description = "Name" | ||
} | ||
|
||
|
||
variable "resource_group_name_community" { | ||
default = "community" | ||
description = "Name" | ||
} | ||
|
||
variable "publickeypath" { | ||
type = string | ||
default = "./ssh/id_rsa.pub" | ||
} | ||
|
||
variable "privatekeypath" { | ||
type = string | ||
default = "./ssh/id_rsa" | ||
} | ||
|
||
variable "user" { | ||
type = string | ||
default = "root" | ||
|
||
} | ||
|
||
variable "ams_version" { | ||
type = string | ||
description = "AMS Version" | ||
} | ||
|
||
variable "zip_file_id" { | ||
description = "Google drive ID" | ||
type = string | ||
} |