add cloudflare stuff
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Torma Kristóf 2022-04-25 22:30:25 +02:00
parent e69aeeac62
commit 562740ff10
7 changed files with 112 additions and 9 deletions

39
.drone.yml Normal file
View File

@ -0,0 +1,39 @@
kind: pipeline
type: docker
name: Apply Cloud infra changes
environment:
ARM_CLIENT_ID:
from_secret: "ARM_CLIENT_ID"
ARM_CLIENT_SECRET:
from_secret: "ARM_CLIENT_SECRET"
ARM_SUBSCRIPTION_ID:
from_secret: "ARM_SUBSCRIPTION_ID"
ARM_TENANT_ID:
from_secret: "ARM_TENANT_ID"
CLOUDFLARE_EMAIL:
from_secret: "CLOUDFLARE_EMAIL"
CLOUDFLARE_API_TOKEN:
from_secret: "CLOUDFLARE_API_TOKEN"
ARTIFACTORY_USERNAME:
from_secret: "ARTIFACTORY_USERNAME"
ARTIFACTORY_PASSWORD:
from_secret: "ARTIFACTORY_PASSWORD"
ARTIFACTORY_URL:
from_secret: "ARTIFACTORY_URL"
steps:
- name: Validate Terraform configuration
image: hashicorp/terraform
commands:
- terraform validate
- name: Check state changes in infrastructure
image: hashicorp/terraform
commands:
- terraform plan
- name: Apply changes
image: hashicorp/terraform
commands:
- terraform apply -auto-approve

7
.gitignore vendored
View File

@ -1,5 +1,4 @@
creds.txt creds.sh
.terraform .terraform
*.tfstate terraform.tfstate*
*.info *.log
*.backup

View File

@ -1,3 +1,5 @@
# cloud-resources # cloud-resources
Terraform configuration for resources in public clouds. Terraform configuration for resources in public clouds.
[![Build Status](https://drone.kmlabz.com/api/badges/stargate-cluster/cloud-resources/status.svg)](https://drone.kmlabz.com/stargate-cluster/cloud-resources)

View File

@ -1,9 +1,9 @@
resource "azurerm_resource_group" "rg-static-site" { resource "azurerm_resource_group" "rg-static-site" {
name = "rg-static-site" name = "rg-static-site"
location = "West Europe" location = "westeurope"
} }
resource "azurerm_resource_group" "rg-personalsite-staticwebapp" { resource "azurerm_resource_group" "rg-personalsite-staticwebapp" {
name = "rg-personalsite-staticwebapp" name = "rg-personalsite-staticwebapp"
location = "West Europe" location = "westeurope"
} }

View File

@ -1,11 +1,23 @@
resource "azurerm_static_site" "tormakristofeu" { resource "azurerm_static_site" "tormakristofeu" {
name = "tormakristofeu" name = "tormakristofeu"
resource_group_name = "rg-static-site" resource_group_name = "rg-static-site"
location = "West Europe" location = "westeurope"
}
resource "azurerm_static_site_custom_domain" "statictormakristofeu" {
static_site_id = azurerm_static_site.tormakristofeu.id
domain_name = "static.tormakristof.eu"
validation_type = "cname-delegation"
} }
resource "azurerm_static_site" "personal-site" { resource "azurerm_static_site" "personal-site" {
name = "personal-site" name = "personal-site"
resource_group_name = "rg-personalsite-staticwebapp" resource_group_name = "rg-personalsite-staticwebapp"
location = "West Europe" location = "westeurope"
}
resource "azurerm_static_site_custom_domain" "wwwtormakristofeu" {
static_site_id = azurerm_static_site.personal-site.id
domain_name = "www.tormakristof.eu"
validation_type = "cname-delegation"
} }

39
cloudflare-zones.tf Normal file
View File

@ -0,0 +1,39 @@
resource "cloudflare_zone" "tormakristofeu" {
zone = "tormakristof.eu"
}
resource "cloudflare_zone_dnssec" "tormakristofeu" {
zone_id = cloudflare_zone.tormakristofeu.id
}
resource "cloudflare_zone" "tormakrisdev" {
zone = "tormakris.dev"
}
resource "cloudflare_zone_dnssec" "tormakrisdev" {
zone_id = cloudflare_zone.tormakrisdev.id
}
resource "cloudflare_zone" "tormaxyz" {
zone = "torma.xyz"
}
resource "cloudflare_zone_dnssec" "tormaxyz" {
zone_id = cloudflare_zone.tormaxyz.id
}
resource "cloudflare_zone" "kmlabzcom" {
zone = "kmlabz.com"
}
resource "cloudflare_zone_dnssec" "kmlabzcom" {
zone_id = cloudflare_zone.kmlabzcom.id
}
resource "cloudflare_zone" "csekventillatorokcom" {
zone = "csakventillatorok.com"
}
resource "cloudflare_zone_dnssec" "csekventillatorokcom" {
zone_id = cloudflare_zone.csekventillatorokcom.id
}

12
main.tf
View File

@ -1,9 +1,18 @@
terraform { terraform {
backend "artifactory" {
repo = "terraform"
subpath = "terraform-state"
}
required_providers { required_providers {
azurerm = { azurerm = {
source = "hashicorp/azurerm" source = "hashicorp/azurerm"
version = "~> 3.0.2" version = "~> 3.0.2"
} }
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 3.0"
}
} }
} }
@ -11,3 +20,6 @@ terraform {
provider "azurerm" { provider "azurerm" {
features {} features {}
} }
provider "cloudflare" {
}