Skip to content

Commit f2f7941

Browse files
committed
Remove default value for CIDR from spaces
1 parent 6694789 commit f2f7941

File tree

2 files changed

+7
-50
lines changed

2 files changed

+7
-50
lines changed

heroku/resource_heroku_space.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func resourceHerokuSpace() *schema.Resource {
4444

4545
"cidr": {
4646
Type: schema.TypeString,
47+
Computed: true,
4748
Optional: true,
48-
Default: "10.0.0.0/16",
4949
ForceNew: true,
5050
},
5151

heroku/resource_heroku_space_test.go

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestAccHerokuSpace(t *testing.T) {
1616
var space spaceWithNAT
1717
spaceName := fmt.Sprintf("tftest1-%s", acctest.RandString(10))
1818
org := testAccConfig.GetAnyOrganizationOrSkip(t)
19-
spaceConfig := testAccCheckHerokuSpaceConfig_basic(spaceName, org, "10.0.0.0/16")
19+
spaceConfig := testAccCheckHerokuSpaceConfig_basic(spaceName, org)
2020

2121
resource.Test(t, resource.TestCase{
2222
PreCheck: func() {
@@ -31,8 +31,7 @@ func TestAccHerokuSpace(t *testing.T) {
3131
Check: resource.ComposeTestCheckFunc(
3232
testAccCheckHerokuSpaceExists("heroku_space.foobar", &space),
3333
resource.TestCheckResourceAttrSet("heroku_space.foobar", "outbound_ips.#"),
34-
resource.TestCheckResourceAttr("heroku_space.foobar", "cidr", "10.0.0.0/16"),
35-
resource.TestCheckResourceAttrSet("heroku_space.foobar", "data_cidr"),
34+
resource.TestCheckResourceAttrSet("heroku_space.foobar", "cidr"),
3635
),
3736
},
3837
// append space test Steps, sharing the space, instead of recreating for each test
@@ -80,47 +79,7 @@ func TestAccHerokuSpace_Fir(t *testing.T) {
8079
resource.TestCheckResourceAttr("heroku_space.foobar", "generation", "fir"),
8180
resource.TestCheckResourceAttr("heroku_space.foobar", "shield", "false"),
8281
resource.TestCheckResourceAttrSet("heroku_space.foobar", "outbound_ips.#"),
83-
resource.TestCheckResourceAttr("heroku_space.foobar", "cidr", "10.0.0.0/16"),
84-
resource.TestCheckResourceAttrSet("heroku_space.foobar", "data_cidr"),
85-
),
86-
},
87-
// Test Fir-specific feature limitations (these should fail)
88-
testStep_AccHerokuSpaceVPNConnection_FirValidation(t, spaceConfig),
89-
testStep_AccHerokuSpaceInboundRuleset_FirValidation(t, spaceConfig),
90-
testStep_AccHerokuSpacePeeringConnection_FirValidation(t, spaceConfig),
91-
},
92-
})
93-
}
94-
95-
// TestAccHerokuSpace_Generation tests default and Cedar generation behavior efficiently
96-
func TestAccHerokuSpace_Generation(t *testing.T) {
97-
var space spaceWithNAT
98-
spaceName := fmt.Sprintf("tftest-gen-%s", acctest.RandString(10))
99-
org := testAccConfig.GetAnyOrganizationOrSkip(t)
100-
101-
resource.Test(t, resource.TestCase{
102-
PreCheck: func() {
103-
testAccPreCheck(t)
104-
},
105-
Providers: testAccProviders,
106-
CheckDestroy: testAccCheckHerokuSpaceDestroy,
107-
Steps: []resource.TestStep{
108-
{
109-
// Test 1: Default generation (should be cedar)
110-
Config: testAccCheckHerokuSpaceConfig_generation(spaceName, org, "", false),
111-
Check: resource.ComposeTestCheckFunc(
112-
testAccCheckHerokuSpaceExists("heroku_space.foobar", &space),
113-
resource.TestCheckResourceAttr("heroku_space.foobar", "generation", "cedar"),
114-
resource.TestCheckResourceAttr("heroku_space.foobar", "shield", "false"),
115-
),
116-
},
117-
{
118-
// Test 2: Explicit cedar generation (ForceNew test - recreates the space)
119-
Config: testAccCheckHerokuSpaceConfig_generation(spaceName, org, "cedar", false),
120-
Check: resource.ComposeTestCheckFunc(
121-
testAccCheckHerokuSpaceExists("heroku_space.foobar", &space),
122-
resource.TestCheckResourceAttr("heroku_space.foobar", "generation", "cedar"),
123-
resource.TestCheckResourceAttr("heroku_space.foobar", "shield", "false"),
82+
resource.TestCheckResourceAttrSet("heroku_space.foobar", "cidr"),
12483
),
12584
},
12685
},
@@ -150,24 +109,22 @@ func TestAccHerokuSpace_GenerationShieldValidation(t *testing.T) {
150109
// ForceNew behavior is already tested in TestAccHerokuSpace_Generation above
151110
// No separate test needed since changing generation recreates the space
152111

153-
func testAccCheckHerokuSpaceConfig_basic(spaceName, orgName, cidr string) string {
112+
func testAccCheckHerokuSpaceConfig_basic(spaceName, orgName string) string {
154113
return fmt.Sprintf(`
155114
resource "heroku_space" "foobar" {
156115
name = "%s"
157116
organization = "%s"
158117
region = "virginia"
159-
cidr = "%s"
160118
}
161-
`, spaceName, orgName, cidr)
119+
`, spaceName, orgName)
162120
}
163121

164122
func testAccCheckHerokuSpaceConfig_generation(spaceName, orgName, generation string, shield bool) string {
165123
config := fmt.Sprintf(`
166124
resource "heroku_space" "foobar" {
167125
name = "%s"
168126
organization = "%s"
169-
region = "virginia"
170-
cidr = "10.0.0.0/16"`, spaceName, orgName)
127+
region = "virginia"`, spaceName, orgName)
171128

172129
if generation != "" {
173130
config += fmt.Sprintf(`

0 commit comments

Comments
 (0)