Skip to content

Commit 49d4874

Browse files
authored
Fix Private Space create without DataCIDR (#373)
1 parent 69a18b0 commit 49d4874

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

heroku/resource_heroku_space.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ func resourceHerokuSpace() *schema.Resource {
4848

4949
"data_cidr": {
5050
Type: schema.TypeString,
51+
Computed: true,
5152
Optional: true,
52-
Default: "10.1.0.0/16",
5353
ForceNew: true,
5454
},
5555

@@ -97,12 +97,12 @@ func resourceHerokuSpaceCreate(d *schema.ResourceData, meta interface{}) error {
9797
opts.Shield = &vs
9898
}
9999

100-
if v := d.Get("cidr"); v != nil {
100+
if v, ok := d.GetOk("cidr"); ok {
101101
vs := v.(string)
102102
opts.CIDR = &vs
103103
}
104104

105-
if v := d.Get("data_cidr"); v != nil {
105+
if v, ok := d.GetOk("data_cidr"); ok {
106106
vs := v.(string)
107107
opts.DataCIDR = &vs
108108
}

heroku/resource_heroku_space_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func TestAccHerokuSpace(t *testing.T) {
1414
var space spaceWithNAT
1515
spaceName := fmt.Sprintf("tftest1-%s", acctest.RandString(10))
1616
org := testAccConfig.GetAnyOrganizationOrSkip(t)
17-
spaceConfig := testAccCheckHerokuSpaceConfig_basic(spaceName, org, "10.0.0.0/16", "10.1.0.0/20")
17+
spaceConfig := testAccCheckHerokuSpaceConfig_basic(spaceName, org, "10.0.0.0/16")
1818

1919
resource.Test(t, resource.TestCase{
2020
PreCheck: func() {
@@ -30,7 +30,7 @@ func TestAccHerokuSpace(t *testing.T) {
3030
testAccCheckHerokuSpaceExists("heroku_space.foobar", &space),
3131
resource.TestCheckResourceAttrSet("heroku_space.foobar", "outbound_ips.#"),
3232
resource.TestCheckResourceAttr("heroku_space.foobar", "cidr", "10.0.0.0/16"),
33-
resource.TestCheckResourceAttr("heroku_space.foobar", "data_cidr", "10.1.0.0/20"),
33+
resource.TestCheckResourceAttrSet("heroku_space.foobar", "data_cidr"),
3434
),
3535
},
3636
// append space test Steps, sharing the space, instead of recreating for each test
@@ -54,16 +54,15 @@ func TestAccHerokuSpace(t *testing.T) {
5454
// …
5555
// }
5656

57-
func testAccCheckHerokuSpaceConfig_basic(spaceName, orgName, cidr, dataCidr string) string {
57+
func testAccCheckHerokuSpaceConfig_basic(spaceName, orgName, cidr string) string {
5858
return fmt.Sprintf(`
5959
resource "heroku_space" "foobar" {
6060
name = "%s"
6161
organization = "%s"
6262
region = "virginia"
6363
cidr = "%s"
64-
data_cidr = "%s"
6564
}
66-
`, spaceName, orgName, cidr, dataCidr)
65+
`, spaceName, orgName, cidr)
6766
}
6867

6968
func testAccCheckHerokuSpaceExists(n string, space *spaceWithNAT) resource.TestCheckFunc {

0 commit comments

Comments
 (0)