diff --git a/pkg/config/resources/network/provider_test.go b/pkg/config/resources/network/provider_test.go index 8d0f450b..da1f339e 100644 --- a/pkg/config/resources/network/provider_test.go +++ b/pkg/config/resources/network/provider_test.go @@ -19,7 +19,7 @@ var bridgeNetwork = dtypes.NetworkResource{ ID: "bridge", Name: "bridge", IPAM: network.IPAM{ - Config: []network.IPAMConfig{network.IPAMConfig{Subnet: "10.8.2.0/24"}}, + Config: []network.IPAMConfig{{Subnet: "10.8.2.0/24"}}, }, } @@ -45,10 +45,10 @@ func TestLookupReturnsID(t *testing.T) { md, p := setupNetworkTests(t, c) testutils.RemoveOn(&md.Mock, "NetworkList") md.On("NetworkList", mock.Anything, mock.Anything).Return([]dtypes.NetworkResource{ - dtypes.NetworkResource{ + { ID: "testnet", IPAM: network.IPAM{ - Config: []network.IPAMConfig{network.IPAMConfig{Subnet: "10.1.2.0/24"}}, + Config: []network.IPAMConfig{{Subnet: "10.1.2.0/24"}}, }, }, bridgeNetwork, @@ -128,10 +128,10 @@ func TestNetworkDoesNOTCreateWhenExists(t *testing.T) { md, p := setupNetworkTests(t, c) testutils.RemoveOn(&md.Mock, "NetworkList") md.On("NetworkList", mock.Anything, mock.Anything).Return([]dtypes.NetworkResource{ - dtypes.NetworkResource{ + { ID: "testnet", IPAM: network.IPAM{ - Config: []network.IPAMConfig{network.IPAMConfig{Subnet: "10.1.2.0/24"}}, + Config: []network.IPAMConfig{{Subnet: "10.1.2.0/24"}}, }, }, bridgeNetwork, }, nil) @@ -150,10 +150,10 @@ func TestCreateWithCorrectNameAndDifferentSubnetReturnsError(t *testing.T) { md, p := setupNetworkTests(t, c) testutils.RemoveOn(&md.Mock, "NetworkList") md.On("NetworkList", mock.Anything, mock.Anything).Return([]dtypes.NetworkResource{ - dtypes.NetworkResource{ + { ID: "testnet", IPAM: network.IPAM{ - Config: []network.IPAMConfig{network.IPAMConfig{Subnet: "10.1.1.0/24"}}, + Config: []network.IPAMConfig{{Subnet: "10.1.1.0/24"}}, }, }, bridgeNetwork, }, nil) @@ -171,10 +171,10 @@ func TestCreateWithOverlappingSubnetReturnsError(t *testing.T) { md, p := setupNetworkTests(t, c) testutils.RemoveOn(&md.Mock, "NetworkList") md.On("NetworkList", mock.Anything, mock.Anything).Return([]dtypes.NetworkResource{ - dtypes.NetworkResource{ + { ID: "abc", IPAM: network.IPAM{ - Config: []network.IPAMConfig{network.IPAMConfig{Subnet: "10.2.0.0/24"}}, + Config: []network.IPAMConfig{{Subnet: "10.2.0.0/24"}}, }, }, bridgeNetwork, }, nil) diff --git a/pkg/config/resources/network/resource.go b/pkg/config/resources/network/resource.go index 3ab67383..410d90ef 100644 --- a/pkg/config/resources/network/resource.go +++ b/pkg/config/resources/network/resource.go @@ -1,8 +1,6 @@ package network import ( - "fmt" - "github.com/jumppad-labs/hclconfig/types" ) @@ -17,23 +15,3 @@ type Network struct { Subnet string `hcl:"subnet" json:"subnet"` EnableIPv6 bool `hcl:"enable_ipv6,optional" json:"enable_ipv6"` } - -func (c *Network) Parse(conf types.Findable) error { - // do any other networks with this name exist? - nets, err := conf.FindResourcesByType(TypeNetwork) - if err != nil { - return err - } - - for _, n := range nets { - if n.Metadata().Name == c.Meta.Name && n.Metadata().ID != c.Meta.ID { - return fmt.Errorf("a network named '%s' is already defined by the resource '%s'", c.Meta.Name, n.Metadata().ID) - } - } - - return nil -} - -func (c *Network) Process() error { - return nil -} diff --git a/pkg/config/resources/terraform/provider_test.go b/pkg/config/resources/terraform/provider_test.go index 75cf449d..50e9516d 100644 --- a/pkg/config/resources/terraform/provider_test.go +++ b/pkg/config/resources/terraform/provider_test.go @@ -72,7 +72,7 @@ func TestCreatesTerraformContainerWithTheCorrectValues(t *testing.T) { ID: "Abc123", }, }, - Version: "1.16.2", + Version: "1.9.8", Source: "../../../../examples/terraform/workspace", } @@ -87,7 +87,7 @@ func TestCreatesTerraformContainerWithTheCorrectValues(t *testing.T) { require.Equal(t, c.Environment["TF_PLUGIN_CACHE_DIR"], "/var/lib/terraform.d") // check the correct image is used - require.Equal(t, c.Image.Name, "hashicorp/terraform:1.16.2") + require.Equal(t, c.Image.Name, "hashicorp/terraform:1.9.8") // check the networks have been added require.Equal(t, c.Networks[0].ID, "Abc123") diff --git a/pkg/config/resources/terraform/resource.go b/pkg/config/resources/terraform/resource.go index 4e5c7dbf..982020b1 100644 --- a/pkg/config/resources/terraform/resource.go +++ b/pkg/config/resources/terraform/resource.go @@ -58,7 +58,7 @@ func (t *Terraform) Process() error { // set the base version if t.Version == "" { - t.Version = "1.16.2" + t.Version = "1.9.8" } // restore the applyoutput from the state