@@ -69,10 +69,12 @@ func resourceGithubEnterpriseCostCenterResourcesCreate(d *schema.ResourceData, m
6969
7070func resourceGithubEnterpriseCostCenterResourcesRead (d * schema.ResourceData , meta any ) error {
7171 client := meta .(* Owner ).v3client
72- enterpriseSlug := d .Get ("enterprise_slug" ).(string )
73- costCenterID := d .Get ("cost_center_id" ).(string )
72+ enterpriseSlug , costCenterID , err := parseTwoPartID (d .Id (), "enterprise_slug" , "cost_center_id" )
73+ if err != nil {
74+ return err
75+ }
7476
75- ctx := context .WithValue (context .Background (), ctxId , fmt . Sprintf ( "%s/%s" , enterpriseSlug , costCenterID ))
77+ ctx := context .WithValue (context .Background (), ctxId , d . Id ( ))
7678
7779 cc , err := enterpriseCostCenterGet (ctx , client , enterpriseSlug , costCenterID )
7880 if err != nil {
@@ -88,6 +90,9 @@ func resourceGithubEnterpriseCostCenterResourcesRead(d *schema.ResourceData, met
8890 sort .Strings (orgs )
8991 sort .Strings (repos )
9092
93+ _ = d .Set ("enterprise_slug" , enterpriseSlug )
94+ _ = d .Set ("cost_center_id" , costCenterID )
95+
9196 _ = d .Set ("users" , stringSliceToAnySlice (users ))
9297 _ = d .Set ("organizations" , stringSliceToAnySlice (orgs ))
9398 _ = d .Set ("repositories" , stringSliceToAnySlice (repos ))
@@ -97,10 +102,12 @@ func resourceGithubEnterpriseCostCenterResourcesRead(d *schema.ResourceData, met
97102
98103func resourceGithubEnterpriseCostCenterResourcesUpdate (d * schema.ResourceData , meta any ) error {
99104 client := meta .(* Owner ).v3client
100- enterpriseSlug := d .Get ("enterprise_slug" ).(string )
101- costCenterID := d .Get ("cost_center_id" ).(string )
105+ enterpriseSlug , costCenterID , err := parseTwoPartID (d .Id (), "enterprise_slug" , "cost_center_id" )
106+ if err != nil {
107+ return err
108+ }
102109
103- ctx := context .WithValue (context .Background (), ctxId , fmt . Sprintf ( "%s/%s" , enterpriseSlug , costCenterID ))
110+ ctx := context .WithValue (context .Background (), ctxId , d . Id ( ))
104111
105112 cc , err := enterpriseCostCenterGet (ctx , client , enterpriseSlug , costCenterID )
106113 if err != nil {
@@ -170,10 +177,12 @@ func resourceGithubEnterpriseCostCenterResourcesUpdate(d *schema.ResourceData, m
170177
171178func resourceGithubEnterpriseCostCenterResourcesDelete (d * schema.ResourceData , meta any ) error {
172179 client := meta .(* Owner ).v3client
173- enterpriseSlug := d .Get ("enterprise_slug" ).(string )
174- costCenterID := d .Get ("cost_center_id" ).(string )
180+ enterpriseSlug , costCenterID , err := parseTwoPartID (d .Id (), "enterprise_slug" , "cost_center_id" )
181+ if err != nil {
182+ return err
183+ }
175184
176- ctx := context .WithValue (context .Background (), ctxId , fmt . Sprintf ( "%s/%s" , enterpriseSlug , costCenterID ))
185+ ctx := context .WithValue (context .Background (), ctxId , d . Id ( ))
177186
178187 cc , err := enterpriseCostCenterGet (ctx , client , enterpriseSlug , costCenterID )
179188 if err != nil {
0 commit comments