diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..f3211c1 --- /dev/null +++ b/.drone.yml @@ -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 diff --git a/.gitignore b/.gitignore index 051eb04..dcf3596 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -creds.txt +creds.sh .terraform -*.tfstate -*.info -*.backup \ No newline at end of file +terraform.tfstate* +*.log diff --git a/README.md b/README.md index 58ed2cc..a43563a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # cloud-resources -Terraform configuration for resources in public clouds. \ No newline at end of file +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) \ No newline at end of file diff --git a/azure-resourcegroups.tf b/azure-resourcegroups.tf index 4ae9593..69f3f7f 100644 --- a/azure-resourcegroups.tf +++ b/azure-resourcegroups.tf @@ -1,9 +1,9 @@ resource "azurerm_resource_group" "rg-static-site" { name = "rg-static-site" - location = "West Europe" + location = "westeurope" } resource "azurerm_resource_group" "rg-personalsite-staticwebapp" { name = "rg-personalsite-staticwebapp" - location = "West Europe" + location = "westeurope" } diff --git a/azure-staticwebapps.tf b/azure-staticwebapps.tf index 1289eb0..e970cf0 100644 --- a/azure-staticwebapps.tf +++ b/azure-staticwebapps.tf @@ -1,11 +1,23 @@ resource "azurerm_static_site" "tormakristofeu" { name = "tormakristofeu" 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" { name = "personal-site" 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" } diff --git a/cloudflare-zones.tf b/cloudflare-zones.tf new file mode 100644 index 0000000..93e83a5 --- /dev/null +++ b/cloudflare-zones.tf @@ -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 +} diff --git a/main.tf b/main.tf index 10012f2..808969d 100644 --- a/main.tf +++ b/main.tf @@ -1,9 +1,18 @@ terraform { + backend "artifactory" { + repo = "terraform" + subpath = "terraform-state" + } required_providers { azurerm = { source = "hashicorp/azurerm" version = "~> 3.0.2" } + + cloudflare = { + source = "cloudflare/cloudflare" + version = "~> 3.0" + } } } @@ -11,3 +20,6 @@ terraform { provider "azurerm" { features {} } + +provider "cloudflare" { +}