Skip to content

Commit f92df34

Browse files
committed
Change github_repository to only Read pages info if pages is in the config
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent c851498 commit f92df34

3 files changed

Lines changed: 2 additions & 27 deletions

File tree

github/data_source_github_repository_pages_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ func TestAccGithubRepositoryPagesDataSource(t *testing.T) {
2323
name = "%s"
2424
visibility = "%s"
2525
auto_init = true
26-
27-
lifecycle {
28-
ignore_changes = [
29-
pages,
30-
]
31-
}
3226
}
3327
3428
resource "github_repository_pages" "test" {

github/resource_github_repository.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ func resourceGithubRepositoryRead(ctx context.Context, d *schema.ResourceData, m
852852
_ = d.Set("squash_merge_commit_title", repo.GetSquashMergeCommitTitle())
853853
}
854854

855-
if repo.GetHasPages() {
855+
_, isPagesConfigured := d.GetOk("pages")
856+
if repo.GetHasPages() && isPagesConfigured {
856857
pages, _, err := client.Repositories.GetPagesInfo(ctx, owner, repoName)
857858
if err != nil {
858859
return diag.FromErr(err)

github/resource_github_repository_pages_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ func TestAccGithubRepositoryPages(t *testing.T) {
2424
visibility = "%s"
2525
auto_init = true
2626
27-
lifecycle {
28-
ignore_changes = [
29-
pages,
30-
]
31-
}
3227
}
3328
3429
resource "github_repository_pages" "test" {
@@ -69,11 +64,6 @@ func TestAccGithubRepositoryPages(t *testing.T) {
6964
visibility = "%s"
7065
auto_init = true
7166
72-
lifecycle {
73-
ignore_changes = [
74-
pages,
75-
]
76-
}
7767
}
7868
7969
resource "github_repository_pages" "test" {
@@ -113,11 +103,6 @@ source {
113103
visibility = "%s"
114104
auto_init = true
115105
116-
lifecycle {
117-
ignore_changes = [
118-
pages,
119-
]
120-
}
121106
}
122107
123108
resource "github_repository_pages" "test" {
@@ -158,11 +143,6 @@ source {
158143
visibility = "%s"
159144
auto_init = true
160145
161-
lifecycle {
162-
ignore_changes = [
163-
pages,
164-
]
165-
}
166146
}
167147
168148
resource "github_repository_pages" "test" {

0 commit comments

Comments
 (0)