Skip to content

Commit 91f6484

Browse files
committed
Comment out owner field for now
Signed-off-by: Timo Sand <[email protected]>
1 parent 6ec5526 commit 91f6484

2 files changed

Lines changed: 19 additions & 22 deletions

File tree

github/resource_github_repository_pages.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ func resourceGithubRepositoryPages() *schema.Resource {
3636
Computed: true,
3737
Description: "The ID of the repository to configure GitHub Pages for.",
3838
},
39-
"owner": {
40-
Type: schema.TypeString,
41-
Required: true,
42-
ForceNew: true,
43-
Description: "The owner of the repository to configure GitHub Pages for.",
44-
},
39+
// TODO: Uncomment this when we are ready to support owner fields properly. https://github.com/integrations/terraform-provider-github/pull/3166#discussion_r2816053082
40+
// "owner": {
41+
// Type: schema.TypeString,
42+
// Required: true,
43+
// ForceNew: true,
44+
// Description: "The owner of the repository to configure GitHub Pages for.",
45+
// },
4546
"source": {
4647
Type: schema.TypeList,
4748
MaxItems: 1,
@@ -104,7 +105,7 @@ func resourceGithubRepositoryPagesCreate(ctx context.Context, d *schema.Resource
104105
meta := m.(*Owner)
105106
client := meta.v3client
106107

107-
owner := d.Get("owner").(string)
108+
owner := meta.name // TODO: Add owner support // d.Get("owner").(string)
108109
repoName := d.Get("repository").(string)
109110

110111
pages := expandPagesForCreate(d)
@@ -161,7 +162,7 @@ func resourceGithubRepositoryPagesRead(ctx context.Context, d *schema.ResourceDa
161162
meta := m.(*Owner)
162163
client := meta.v3client
163164

164-
owner := d.Get("owner").(string)
165+
owner := meta.name // TODO: Add owner support // d.Get("owner").(string)
165166
repoName := d.Get("repository").(string)
166167

167168
pages, resp, err := client.Repositories.GetPagesInfo(ctx, owner, repoName)
@@ -216,7 +217,7 @@ func resourceGithubRepositoryPagesUpdate(ctx context.Context, d *schema.Resource
216217
meta := m.(*Owner)
217218
client := meta.v3client
218219

219-
owner := d.Get("owner").(string)
220+
owner := meta.name // TODO: Add owner support // d.Get("owner").(string)
220221
repoName := d.Get("repository").(string)
221222

222223
update := &github.PagesUpdate{}
@@ -263,7 +264,7 @@ func resourceGithubRepositoryPagesDelete(ctx context.Context, d *schema.Resource
263264
meta := m.(*Owner)
264265
client := meta.v3client
265266

266-
owner := d.Get("owner").(string)
267+
owner := meta.name // TODO: Add owner support // d.Get("owner").(string)
267268
repoName := d.Get("repository").(string)
268269

269270
_, err := client.Repositories.DisablePages(ctx, owner, repoName)
@@ -279,9 +280,9 @@ func resourceGithubRepositoryPagesImport(ctx context.Context, d *schema.Resource
279280
if err != nil {
280281
return nil, fmt.Errorf("invalid ID specified: supplied ID must be written as <owner>:<repository>. Original error: %w", err)
281282
}
282-
if err := d.Set("owner", owner); err != nil {
283-
return nil, err
284-
}
283+
// if err := d.Set("owner", owner); err != nil { // TODO: Add owner support
284+
// return nil, err
285+
// }
285286
if err := d.Set("repository", repoName); err != nil {
286287
return nil, err
287288
}

github/resource_github_repository_pages_test.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ func TestAccGithubRepositoryPages(t *testing.T) {
3131
}
3232
3333
resource "github_repository_pages" "test" {
34-
owner = "%s"
3534
repository = github_repository.test.name
3635
build_type = "legacy"
3736
source {
3837
branch = "main"
3938
path = "/"
4039
}
4140
}
42-
`, repoName, baseRepoVisibility, testAccConf.owner)
41+
`, repoName, baseRepoVisibility)
4342

4443
resource.Test(t, resource.TestCase{
4544
PreCheck: func() { skipUnauthenticated(t) },
@@ -71,11 +70,10 @@ func TestAccGithubRepositoryPages(t *testing.T) {
7170
}
7271
7372
resource "github_repository_pages" "test" {
74-
owner = "%s"
7573
repository = github_repository.test.name
7674
build_type = "workflow"
7775
}
78-
`, repoName, baseRepoVisibility, testAccConf.owner)
76+
`, repoName, baseRepoVisibility)
7977

8078
resource.Test(t, resource.TestCase{
8179
PreCheck: func() { skipUnauthenticated(t) },
@@ -110,7 +108,6 @@ source {
110108
}
111109
112110
resource "github_repository_pages" "test" {
113-
owner = "%s"
114111
repository = github_repository.test.name
115112
build_type = "%s"
116113
%s
@@ -122,13 +119,13 @@ source {
122119
ProviderFactories: providerFactories,
123120
Steps: []resource.TestStep{
124121
{
125-
Config: fmt.Sprintf(config, repoName, baseRepoVisibility, testAccConf.owner, "legacy", sourceConfig),
122+
Config: fmt.Sprintf(config, repoName, baseRepoVisibility, "legacy", sourceConfig),
126123
ConfigStateChecks: []statecheck.StateCheck{
127124
statecheck.ExpectKnownValue("github_repository_pages.test", tfjsonpath.New("build_type"), knownvalue.StringExact("legacy")),
128125
},
129126
},
130127
{
131-
Config: fmt.Sprintf(config, repoName, baseRepoVisibility, testAccConf.owner, "workflow", ""),
128+
Config: fmt.Sprintf(config, repoName, baseRepoVisibility, "workflow", ""),
132129
ConfigStateChecks: []statecheck.StateCheck{
133130
statecheck.ExpectKnownValue("github_repository_pages.test", tfjsonpath.New("build_type"), knownvalue.StringExact("workflow")),
134131
},
@@ -150,15 +147,14 @@ source {
150147
}
151148
152149
resource "github_repository_pages" "test" {
153-
owner = "%s"
154150
repository = github_repository.test.name
155151
build_type = "legacy"
156152
source {
157153
branch = "main"
158154
path = "/"
159155
}
160156
}
161-
`, repoName, baseRepoVisibility, testAccConf.owner)
157+
`, repoName, baseRepoVisibility)
162158

163159
resource.Test(t, resource.TestCase{
164160
PreCheck: func() { skipUnauthenticated(t) },

0 commit comments

Comments
 (0)