Created
May 30, 2021 07:35
-
-
Save kimihito/42697312b4d74a85a3120a4249ec3b74 to your computer and use it in GitHub Desktop.
Use Terraform for deploying Digital Ocean App platform
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
terraform { | |
required_providers { | |
digitalocean = { | |
source = "digitalocean/digitalocean" | |
version = "~> 2.0" | |
} | |
} | |
} | |
# Set the variable value in *.tfvars file | |
# or using -var="do_token=..." CLI option | |
variable "do_token" {} | |
# Configure the DigitalOcean Provider | |
provider "digitalocean" { | |
token = var.do_token | |
} | |
resource "digitalocean_database_cluster" "redis-example" { | |
name = "example-redis-cluster" | |
engine = "redis" | |
version = "6" | |
size = "db-s-1vcpu-1gb" | |
region = "nyc1" | |
node_count = 1 | |
} | |
resource "digitalocean_app" "static-ste-example" { | |
spec { | |
name = "static-ste-example" | |
region = "sgp" | |
static_site { | |
name = "sample-jekyll" | |
build_command = "bundle exec jekyll build -d ./public" | |
output_dir = "/public" | |
git { | |
repo_clone_url = "https://github.com/digitalocean/sample-jekyll.git" | |
branch = "main" | |
} | |
} | |
database { | |
name = "starter-db" | |
engine = "PG" | |
production = false | |
} | |
database { | |
name = "starter-redis" | |
engine = "REDIS" | |
production = true | |
cluster_name = digitalocean_database_cluster.redis-example.name | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment