MrElephantt
MrElephantt
CDCloudflare Developers
Created by Cyb3r-Jak3 on 7/29/2023 in #terraform-provider-cloudflare
terraform_pages_issue
@Cyb3r-Jok3 Sorry took me a bit to come around and test it but it works! The only changes that were made were the following
build_config {
...
-root_dir="" # removed
}
...
source {
...
+pr_comments_enabled = true
+deployments_enabled = true
}
build_config {
...
-root_dir="" # removed
}
...
source {
...
+pr_comments_enabled = true
+deployments_enabled = true
}
Seems minor but obviously something in there did it. But 2 additional questions that maybe you could help answer. 1. The deployment wasn't created automatically, is there something that can be done to enable them automatically? 2. How do you configure account_id via account_id = var.account_id? I'd like to configure mine in another way other than plain text, I have yet to commit it because I don't want it in there.
10 replies
CDCloudflare Developers
Created by Cyb3r-Jak3 on 7/29/2023 in #terraform-provider-cloudflare
terraform_pages_issue
I guess maybe this will could help as well to determine if my terraform file is bad.
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
}

resource "cloudflare_pages_project" "resume" {
account_id = "[redacted]"
name = "resume-site"
production_branch = "main"

build_config {
build_command = "npm run build"
destination_dir = "public"
}

source {
type = "github"
config {
owner = "[redacted]
repo_name = "resume"
production_branch = "main"
pr_comments_enabled = true
deployments_enabled = true
production_deployment_enabled = true
preview_branch_excludes = ["main"]
}
}
}
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
}

resource "cloudflare_pages_project" "resume" {
account_id = "[redacted]"
name = "resume-site"
production_branch = "main"

build_config {
build_command = "npm run build"
destination_dir = "public"
}

source {
type = "github"
config {
owner = "[redacted]
repo_name = "resume"
production_branch = "main"
pr_comments_enabled = true
deployments_enabled = true
production_deployment_enabled = true
preview_branch_excludes = ["main"]
}
}
}
10 replies
CDCloudflare Developers
Created by Cyb3r-Jak3 on 7/29/2023 in #terraform-provider-cloudflare
terraform_pages_issue
Do you have an example of a simple pages terraform file that worked for you? I tried another project and I'm still getting 500s.
10 replies
CDCloudflare Developers
Created by Cyb3r-Jak3 on 7/29/2023 in #terraform-provider-cloudflare
terraform_pages_issue
@Cyb3r-Jok3 here is the log, it looks like it was repeating over and over again so I trimmed it up, hopefully not too much. https://gist.github.com/snaveevans/68db6118a2c8c9f4cb88fe9a407871a9
10 replies
CDCloudflare Developers
Created by Cyb3r-Jak3 on 7/29/2023 in #terraform-provider-cloudflare
terraform_pages_issue
Well I finally realized I had accidentally set the start date on the token and not the end date. So that fixed 1 issue but I'm still getting an error.
Error: error creating cloudflare pages project "cranberry": received internal server error response (HTTP 500), please try again later

│ with cloudflare_pages_project.cranberry,
│ on cloudflare.tf line 10, in resource "cloudflare_pages_project" "cranberry":
│ 10: resource "cloudflare_pages_project" "cranberry" {
Error: error creating cloudflare pages project "cranberry": received internal server error response (HTTP 500), please try again later

│ with cloudflare_pages_project.cranberry,
│ on cloudflare.tf line 10, in resource "cloudflare_pages_project" "cranberry":
│ 10: resource "cloudflare_pages_project" "cranberry" {
10 replies