First working version
This commit is contained in:
parent
2dc844f040
commit
a680939b87
13
README.md
13
README.md
@ -1,2 +1,15 @@
|
||||
# digitalocean_droplet
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
module "test1" {
|
||||
source = "git::https://git.fdragon.com/TerraformModules/digitalocean_droplet.git"
|
||||
host_name = "hello-world"
|
||||
domain_name = "example.com"
|
||||
ssh_keys = [
|
||||
data.digitalocean_ssh_key.example.id,
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
3
data.digitalocean_domain.this.tf
Normal file
3
data.digitalocean_domain.this.tf
Normal file
@ -0,0 +1,3 @@
|
||||
data "digitalocean_domain" "this" {
|
||||
name = var.domain_name
|
||||
}
|
3
data.digitalocean_vpc.this.tf
Normal file
3
data.digitalocean_vpc.this.tf
Normal file
@ -0,0 +1,3 @@
|
||||
data "digitalocean_vpc" "this" {
|
||||
name = var.vpc_name
|
||||
}
|
3
output.droplet.tf
Normal file
3
output.droplet.tf
Normal file
@ -0,0 +1,3 @@
|
||||
output "droplet" {
|
||||
value = digitalocean_droplet.this
|
||||
}
|
12
resource.digitalocean_droplet.this.tf
Normal file
12
resource.digitalocean_droplet.this.tf
Normal file
@ -0,0 +1,12 @@
|
||||
resource "digitalocean_droplet" "this" {
|
||||
backups = "true"
|
||||
image = var.image_name
|
||||
ipv6 = "true"
|
||||
monitoring = "false"
|
||||
name = "${var.host_name}.${var.domain_name}"
|
||||
private_networking = "true"
|
||||
region = var.region
|
||||
ssh_keys = var.ssh_keys
|
||||
size = var.size
|
||||
vpc_uuid = data.digitalocean_vpc.this.id
|
||||
}
|
6
resource.digitalocean_record.A.tf
Normal file
6
resource.digitalocean_record.A.tf
Normal file
@ -0,0 +1,6 @@
|
||||
resource "digitalocean_record" "A" {
|
||||
domain = data.digitalocean_domain.this.name
|
||||
name = var.host_name
|
||||
type = "A"
|
||||
value = digitalocean_droplet.this.ipv4_address
|
||||
}
|
6
resource.digitalocean_record.AAAA.tf
Normal file
6
resource.digitalocean_record.AAAA.tf
Normal file
@ -0,0 +1,6 @@
|
||||
resource "digitalocean_record" "AAAA" {
|
||||
domain = data.digitalocean_domain.this.name
|
||||
name = var.host_name
|
||||
type = "AAAA"
|
||||
value = digitalocean_droplet.this.ipv6_address
|
||||
}
|
6
terraform.tf
Normal file
6
terraform.tf
Normal file
@ -0,0 +1,6 @@
|
||||
terraform {
|
||||
required_version = ">= 0.12"
|
||||
required_providers {
|
||||
digitalocean = ">= 1.18.0"
|
||||
}
|
||||
}
|
4
variable.domain_name.tf
Normal file
4
variable.domain_name.tf
Normal file
@ -0,0 +1,4 @@
|
||||
variable "domain_name" {
|
||||
default = "example.com"
|
||||
type = string
|
||||
}
|
4
variable.host_name.tf
Normal file
4
variable.host_name.tf
Normal file
@ -0,0 +1,4 @@
|
||||
variable "host_name" {
|
||||
default = "hello-world"
|
||||
type = string
|
||||
}
|
4
variable.image_name.tf
Normal file
4
variable.image_name.tf
Normal file
@ -0,0 +1,4 @@
|
||||
variable "image_name" {
|
||||
default = "fedora-32-x64"
|
||||
type = string
|
||||
}
|
4
variable.region.tf
Normal file
4
variable.region.tf
Normal file
@ -0,0 +1,4 @@
|
||||
variable "region" {
|
||||
default = "nyc3"
|
||||
type = string
|
||||
}
|
4
variable.size.tf
Normal file
4
variable.size.tf
Normal file
@ -0,0 +1,4 @@
|
||||
variable "size" {
|
||||
default = "s-1vcpu-1gb"
|
||||
type = string
|
||||
}
|
3
variable.ssh_keys.tf
Normal file
3
variable.ssh_keys.tf
Normal file
@ -0,0 +1,3 @@
|
||||
variable "ssh_keys" {
|
||||
type = list
|
||||
}
|
4
variable.vpc_name.tf
Normal file
4
variable.vpc_name.tf
Normal file
@ -0,0 +1,4 @@
|
||||
variable "vpc_name" {
|
||||
default = "nyc3"
|
||||
type = string
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user