mirror of
https://github.com/imjasonh/cftf
synced 2026-07-06 20:12:17 +00:00
initial commit
Signed-off-by: Jason Hall <jason@chainguard.dev>
This commit is contained in:
parent
861978fbb9
commit
5671032ceb
2 changed files with 98 additions and 0 deletions
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
*.tfvars
|
||||
|
||||
*.dll
|
||||
*.exe
|
||||
.DS_Store
|
||||
example.tf
|
||||
terraform.tfplan
|
||||
terraform.tfstate
|
||||
bin/
|
||||
dist/
|
||||
modules-dev/
|
||||
/pkg/
|
||||
website/.vagrant
|
||||
website/.bundle
|
||||
website/build
|
||||
website/node_modules
|
||||
.vagrant/
|
||||
*.backup
|
||||
./*.tfstate
|
||||
.terraform/
|
||||
*.log
|
||||
*.bak
|
||||
*~
|
||||
.*.swp
|
||||
.idea
|
||||
*.iml
|
||||
*.test
|
||||
*.iml
|
||||
|
||||
website/vendor
|
||||
|
||||
# Test exclusions
|
||||
!command/test-fixtures/**/*.tfstate
|
||||
!command/test-fixtures/**/.terraform/
|
||||
|
||||
# Keep windows files with windows line endings
|
||||
*.winfile eol=crlf
|
||||
|
||||
terraform-provider-cosign
|
||||
.terraform.lock.hcl
|
||||
58
main.tf
Normal file
58
main.tf
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
cloudflare = {
|
||||
source = "cloudflare/cloudflare"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "account_id" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "api_token" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "domain" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "bucket" {
|
||||
type = string
|
||||
}
|
||||
|
||||
provider "cloudflare" {
|
||||
api_token = var.api_token
|
||||
}
|
||||
|
||||
resource "cloudflare_zone" "zone" {
|
||||
account_id = var.account_id
|
||||
zone = var.domain
|
||||
}
|
||||
|
||||
resource "cloudflare_worker_route" "route" {
|
||||
zone_id = cloudflare_zone.zone.id
|
||||
pattern = "${cloudflare_zone.zone.zone}/*"
|
||||
script_name = cloudflare_worker_script.script.name
|
||||
}
|
||||
|
||||
resource "cloudflare_worker_script" "script" {
|
||||
account_id = var.account_id
|
||||
name = "script"
|
||||
content = file("../workers-sdk/templates/examples/fast-google-fonts/fast-google-fonts.js")
|
||||
|
||||
/*
|
||||
r2_bucket_binding {
|
||||
name = "BUCKET"
|
||||
bucket_name = var.bucket
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
resource "cloudflare_worker_domain" "example" {
|
||||
account_id = var.account_id
|
||||
hostname = "worker.${cloudflare_zone.zone.zone}"
|
||||
service = cloudflare_worker_script.script.name
|
||||
zone_id = cloudflare_zone.zone.id
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue