@@ -122,13 +122,16 @@ func ResourceCockpitAlertManagerCreate(ctx context.Context, d *schema.ResourceDa
122122 return ResourceCockpitAlertManagerRead (ctx , d , m )
123123}
124124
125- func ResourceCockpitAlertManagerRead (ctx context.Context , d * schema.ResourceData , meta interface {}) diag.Diagnostics {
126- api , region , err := cockpitAPIWithRegion (d , meta )
125+ func ResourceCockpitAlertManagerRead (ctx context.Context , d * schema.ResourceData , m interface {}) diag.Diagnostics {
126+ api , region , err := cockpitAPIWithRegion (d , m )
127127 if err != nil {
128128 return diag .FromErr (err )
129129 }
130130
131- projectID := d .Get ("project_id" ).(string )
131+ projectID , _ , err := meta .ExtractProjectID (d , m )
132+ if err != nil {
133+ return diag .FromErr (err )
134+ }
132135
133136 alertManager , err := api .GetAlertManager (& cockpit.RegionalAPIGetAlertManagerRequest {
134137 Region : region ,
@@ -166,13 +169,16 @@ func ResourceCockpitAlertManagerRead(ctx context.Context, d *schema.ResourceData
166169 return nil
167170}
168171
169- func ResourceCockpitAlertManagerUpdate (ctx context.Context , d * schema.ResourceData , meta interface {}) diag.Diagnostics {
170- api , region , err := cockpitAPIWithRegion (d , meta )
172+ func ResourceCockpitAlertManagerUpdate (ctx context.Context , d * schema.ResourceData , m interface {}) diag.Diagnostics {
173+ api , region , err := cockpitAPIWithRegion (d , m )
171174 if err != nil {
172175 return diag .FromErr (err )
173176 }
174177
175- projectID := d .Get ("project_id" ).(string )
178+ projectID , _ , err := meta .ExtractProjectID (d , m )
179+ if err != nil {
180+ return diag .FromErr (err )
181+ }
176182
177183 if d .HasChange ("enable_managed_alerts" ) {
178184 enable := d .Get ("enable_managed_alerts" ).(bool )
@@ -243,16 +249,19 @@ func ResourceCockpitAlertManagerUpdate(ctx context.Context, d *schema.ResourceDa
243249 }
244250 }
245251
246- return ResourceCockpitAlertManagerRead (ctx , d , meta )
252+ return ResourceCockpitAlertManagerRead (ctx , d , m )
247253}
248254
249- func ResourceCockpitAlertManagerDelete (ctx context.Context , d * schema.ResourceData , meta interface {}) diag.Diagnostics {
250- api , region , err := cockpitAPIWithRegion (d , meta )
255+ func ResourceCockpitAlertManagerDelete (ctx context.Context , d * schema.ResourceData , m interface {}) diag.Diagnostics {
256+ api , region , err := cockpitAPIWithRegion (d , m )
251257 if err != nil {
252258 return diag .FromErr (err )
253259 }
254260
255- projectID := d .Get ("project_id" ).(string )
261+ projectID , _ , err := meta .ExtractProjectID (d , m )
262+ if err != nil {
263+ return diag .FromErr (err )
264+ }
256265
257266 contactPoints , err := api .ListContactPoints (& cockpit.RegionalAPIListContactPointsRequest {
258267 Region : region ,
0 commit comments