File tree Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ vagrant/provisioning/roles/php-coder.nginx/
3232vagrant /provisioning /roles /mystamps-nginx /files /prod /my-stamps.ru.key
3333vagrant /provisioning /roles /mystamps-nginx /files /prod /my-stamps.ru.crt
3434
35+ # Terraform related files
36+ infra /terraform /.terraform /
37+ infra /terraform /terraform.tfplan
38+ infra /terraform /terraform.tfvars
39+ infra /terraform /terraform.tfstate
40+
3541# used by docker/prod.yml
3642docker /application-prod.properties
3743docker /mysql_backup_mystamps.sql.gz
Original file line number Diff line number Diff line change 1+ # Provisioning a server with Terraform
2+
3+ * Setup credentials (only first time)
4+ ``` console
5+ $ cd infra/terraform
6+ $ cp terraform.tfvars{.example,}
7+ $ vim terraform.tfvars
8+ ```
9+ * Initialize and download modules (if needed)
10+ ``` console
11+ $ terraform init
12+ ```
13+ * Import existing configuration (optionally; only first time)
14+ ``` console
15+ $ terraform import digitalocean_droplet.web <id>
16+ ```
17+ * Plan and apply:
18+ ``` console
19+ $ terraform plan -out terraform.tfplan
20+ $ terraform apply terraform.tfplan
21+ ```
Original file line number Diff line number Diff line change 1+ # @todo #1000 CI: validate and check Terraform configuration
2+
3+ variable "token" {}
4+
5+ # Provider docs: https://www.terraform.io/docs/providers/do/index.html
6+ provider "digitalocean" {
7+ token = var. token
8+ version = " ~> 1.12"
9+ }
10+
11+ # Droplet docs: https://www.terraform.io/docs/providers/do/r/droplet.html
12+ resource "digitalocean_droplet" "web" {
13+ # "ubuntu-16-04-x64" resolves into Ubuntu 16.04.6 while our server is based on Ubuntu 16.04.1
14+ image = " 18572320"
15+ name = " my-stamps.ru"
16+ region = " fra1"
17+ size = " s-1vcpu-1gb"
18+ private_networking = true
19+ }
20+
Original file line number Diff line number Diff line change 1+ # How to obtain a token: https://www.digitalocean.com/docs/api/create-personal-access-token/
2+ token = "<insert-token-here>"
You can’t perform that action at this time.
0 commit comments