Skip to content

Commit

Permalink
Merge pull request #1898 from Cyb3r-Jak3/page-project-source
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Sep 8, 2022
2 parents f172978 + 4caf20a commit ddca523
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/1898.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/cloudflare_pages_project: fix null source on project create
```
3 changes: 2 additions & 1 deletion internal/provider/resource_cloudflare_pages_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func buildPagesProject(d *schema.ResourceData) cloudflare.PagesProject {
if webAnalyticsTag, ok := d.GetOk("build_config.0.web_analytics_tag"); ok {
buildConfig.WebAnalyticsTag = webAnalyticsTag.(string)
}
if webAnalyticsToken, ok := d.GetOk("build_config.0.web_analytics_tag"); ok {
if webAnalyticsToken, ok := d.GetOk("build_config.0.web_analytics_token"); ok {
buildConfig.WebAnalyticsToken = webAnalyticsToken.(string)
}
project.BuildConfig = buildConfig
Expand Down Expand Up @@ -148,6 +148,7 @@ func buildPagesProject(d *schema.ResourceData) cloudflare.PagesProject {
}
source.Config = &sourceConfig
}
project.Source = &source
}

if previewConfig, ok := d.GetOk("deployment_configs.0.preview.0"); ok {
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/resource_cloudflare_pages_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func testPagesProjectProductionOnly(resourceID, accountID, projectName string) s
`, resourceID, accountID, projectName)
}

func TestAccTestPagesProject_Basic(t *testing.T) {
func TestAccCloudflarePagesProject_Basic(t *testing.T) {
rnd := generateRandomResourceName()
name := "cloudflare_pages_project." + rnd
accountID := os.Getenv("CLOUDFLARE_ACCOUNT_ID")
Expand Down Expand Up @@ -218,7 +218,7 @@ func TestAccTestPagesProject_Basic(t *testing.T) {
})
}

func TestAccTestPagesProject_BuildConfig(t *testing.T) {
func TestAccCloudflarePagesProject_BuildConfig(t *testing.T) {
rnd := generateRandomResourceName()
name := "cloudflare_pages_project." + rnd
accountID := os.Getenv("CLOUDFLARE_ACCOUNT_ID")
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestAccTestPagesProject_BuildConfig(t *testing.T) {
})
}

func TestAccTestPagesProject_DeploymentConfig(t *testing.T) {
func TestAccCloudflarePagesProject_DeploymentConfig(t *testing.T) {
rnd := generateRandomResourceName()
name := "cloudflare_pages_project." + rnd
accountID := os.Getenv("CLOUDFLARE_ACCOUNT_ID")
Expand Down Expand Up @@ -316,7 +316,7 @@ func TestAccTestPagesProject_DeploymentConfig(t *testing.T) {
})
}

func TestAccTestPagesProject_DirectUpload(t *testing.T) {
func TestAccCloudflarePagesProject_DirectUpload(t *testing.T) {
rnd := generateRandomResourceName()
name := "cloudflare_pages_project." + rnd
accountID := os.Getenv("CLOUDFLARE_ACCOUNT_ID")
Expand All @@ -340,7 +340,7 @@ func TestAccTestPagesProject_DirectUpload(t *testing.T) {
})
}

func TestAccTestPagesProject_PreviewOnly(t *testing.T) {
func TestAccCloudflarePagesProject_PreviewOnly(t *testing.T) {
rnd := generateRandomResourceName()
name := "cloudflare_pages_project." + rnd
accountID := os.Getenv("CLOUDFLARE_ACCOUNT_ID")
Expand Down Expand Up @@ -382,7 +382,7 @@ func TestAccTestPagesProject_PreviewOnly(t *testing.T) {
})
}

func TestAccTestPagesProject_ProductionOnly(t *testing.T) {
func TestAccCloudflarePagesProject_ProductionOnly(t *testing.T) {
rnd := generateRandomResourceName()
name := "cloudflare_pages_project." + rnd
accountID := os.Getenv("CLOUDFLARE_ACCOUNT_ID")
Expand Down

0 comments on commit ddca523

Please sign in to comment.