Skip to content

Commit 6694789

Browse files
committed
Pass generation field to Heroku API for space creation
- Add generation field to SpaceCreateOpts when creating spaces - Fix resourceHerokuSpaceRead to properly read generation from API response - Ensure users get the generation they specify instead of defaulting to Cedar - Add debug logging for space creation with generation - Tested: Cedar space creation confirmed working, Fir space API correctly validates generation
1 parent edfcec6 commit 6694789

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

heroku/resource_heroku_space.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ func resourceHerokuSpaceCreate(d *schema.ResourceData, meta interface{}) error {
119119
opts.DataCIDR = &vs
120120
}
121121

122+
if v, ok := d.GetOk("generation"); ok {
123+
vs := v.(string)
124+
opts.Generation = &vs
125+
log.Printf("[DEBUG] Creating space with generation: %s", vs)
126+
}
127+
122128
space, err := client.SpaceCreate(context.TODO(), opts)
123129
if err != nil {
124130
return err
@@ -164,6 +170,13 @@ func resourceHerokuSpaceRead(d *schema.ResourceData, meta interface{}) error {
164170
d.Set("cidr", space.CIDR)
165171
d.Set("data_cidr", space.DataCIDR)
166172

173+
// Set generation from API response, defaulting to cedar for backward compatibility
174+
if space.Generation.Name != "" {
175+
d.Set("generation", space.Generation.Name)
176+
} else {
177+
d.Set("generation", "cedar")
178+
}
179+
167180
// Validate generation features during plan phase (warn only)
168181
generation := d.Get("generation")
169182
if generation == nil {

0 commit comments

Comments
 (0)