Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit e99ab58

Browse files
Fix cost center resources import test ID
1 parent 481e880 commit e99ab58

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

github/resource_github_enterprise_cost_center_resources_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,17 @@ func TestAccGithubEnterpriseCostCenterResources(t *testing.T) {
146146
ImportState: true,
147147
ImportStateVerify: true,
148148
ImportStateIdFunc: func(s *terraform.State) (string, error) {
149-
rs, ok := s.RootModule().Resources["github_enterprise_cost_center.test"]
149+
rs, ok := s.RootModule().Resources["github_enterprise_cost_center_resources.test"]
150150
if !ok {
151151
return "", fmt.Errorf("resource not found in state")
152152
}
153-
return fmt.Sprintf("%s/%s", testEnterprise, rs.Primary.ID), nil
153+
154+
enterpriseSlug := rs.Primary.Attributes["enterprise_slug"]
155+
costCenterID := rs.Primary.Attributes["cost_center_id"]
156+
if enterpriseSlug == "" || costCenterID == "" {
157+
return "", fmt.Errorf("missing enterprise_slug or cost_center_id in state")
158+
}
159+
return fmt.Sprintf("%s/%s", enterpriseSlug, costCenterID), nil
154160
},
155161
},
156162
},

0 commit comments

Comments
 (0)