Skip to content

Commit

Permalink
fuxp Net
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-toa committed Mar 11, 2023
1 parent 1626b9b commit 1044386
Show file tree
Hide file tree
Showing 47 changed files with 155 additions and 184 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/acceptance_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
Acceptances_tests:
environment: RUNNER_ACCESS
concurrency: terraform-acceptance-test
runs-on: [self-hosted, linux, us-east-2]
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Build go test
run: make test
- name: Run acceptance tests
run: make testacc
run: make test-net
env:
OUTSCALE_ACCESSKEYID: ${{ secrets.OSC_ACCESS_KEY }}
OUTSCALE_SECRETKEYID: ${{ secrets.OSC_SECRET_KEY }}
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/net_testacc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Net Acceptances tests

on:
pull_request_target:
branches:
- master
paths:
- '**.go'
- '**.sum'
- '**.mod'
- 'GNUmakefile'
workflow_dispatch:

jobs:
Acceptances_tests:
environment: RUNNER_ACCESS
concurrency: terraform-acceptance-test
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: outscale-dev/frieza-github-actions/frieza-clean@master
with:
access_key: ${{ secrets.OSC_ACCESS_KEY }}
secret_key: ${{ secrets.OSC_SECRET_KEY }}
region: ${{ secrets.OSC_REGION }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '>=1.18.0'
- name: Build go test
run: make test
- name: Run net acceptance tests
run: make test-net
env:
OUTSCALE_ACCESSKEYID: ${{ secrets.OSC_ACCESS_KEY }}
OUTSCALE_SECRETKEYID: ${{ secrets.OSC_SECRET_KEY }}
OUTSCALE_REGION: ${{ secrets.OSC_REGION }}
OUTSCALE_ACCOUNT: ${{ secrets.OSC_ACCOUNT_ID }}
OUTSCALE_IMAGEID: ${{ secrets.OUTSCALE_IMAGEID }}
5 changes: 5 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ test: fmtcheck
testacc: fmtcheck
TF_ACC=1 go test $(TEST) -count 1 -v -parallel 4 $(TESTARGS) -timeout 240m -cover

.PHONY: test-net
test-net: fmtcheck
TF_ACC=1 go test $(TEST) -run=TestAccNet -count 1 -v -parallel 1 $(TESTARGS) -timeout 240m -cover


.PHONY: fmt
fmt:
gofmt -s -w ./main.go
Expand Down
24 changes: 12 additions & 12 deletions outscale/data_source_outscale_nat_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

func TestAccOutscaleOAPINatServiceDataSource_Instance(t *testing.T) {
func TestAccNet_WithNatServiceDataSource_Instance(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down Expand Up @@ -50,41 +50,41 @@ const testAccCheckOutscaleOAPINatServiceDataSourceConfig = `
}
resource "outscale_subnet" "outscale_subnet" {
net_id = "${outscale_net.outscale_net.net_id}"
net_id = outscale_net.outscale_net.net_id
ip_range = "10.0.0.0/18"
}
resource "outscale_public_ip" "outscale_public_ip" {}
resource "outscale_nat_service" "outscale_nat_service" {
depends_on = ["outscale_route.outscale_route"]
subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}"
public_ip_id = "${outscale_public_ip.outscale_public_ip.public_ip_id}"
subnet_id = outscale_subnet.outscale_subnet.subnet_id
public_ip_id = outscale_public_ip.outscale_public_ip.public_ip_id
}
resource "outscale_route_table" "outscale_route_table" {
net_id = "${outscale_net.outscale_net.net_id}"
net_id = outscale_net.outscale_net.net_id
}
resource "outscale_route" "outscale_route" {
destination_ip_range = "0.0.0.0/0"
gateway_id = "${outscale_internet_service.outscale_internet_service.internet_service_id}"
route_table_id = "${outscale_route_table.outscale_route_table.route_table_id}"
gateway_id = outscale_internet_service.outscale_internet_service.internet_service_id
route_table_id = outscale_route_table.outscale_route_table.route_table_id
}
resource "outscale_route_table_link" "outscale_route_table_link" {
subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}"
route_table_id = "${outscale_route_table.outscale_route_table.id}"
subnet_id = outscale_subnet.outscale_subnet.subnet_id
route_table_id = outscale_route_table.outscale_route_table.id
}
resource "outscale_internet_service" "outscale_internet_service" {}
resource "outscale_internet_service_link" "outscale_internet_service_link" {
net_id = "${outscale_net.outscale_net.net_id}"
internet_service_id = "${outscale_internet_service.outscale_internet_service.id}"
net_id = outscale_net.outscale_net.net_id}"
internet_service_id = outscale_internet_service.outscale_internet_service.id
}
data "outscale_nat_service" "nat" {
nat_service_id = "${outscale_nat_service.outscale_nat_service.id}"
nat_service_id = outscale_nat_service.outscale_nat_service.id
}
`
10 changes: 5 additions & 5 deletions outscale/data_source_outscale_nat_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestAccOutscaleOAPINatServicesDataSource_Instance(t *testing.T) {
func TestAccNet_WithNatServicesDataSource_Instance(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down Expand Up @@ -35,20 +35,20 @@ const testAccCheckOutscaleOAPINatServicesDataSourceConfig = `
}
resource "outscale_subnet" "outscale_subnet" {
net_id = "${outscale_net.outscale_net.net_id}"
net_id = outscale_net.outscale_net.net_id
ip_range = "10.0.0.0/18"
}
resource "outscale_public_ip" "outscale_public_ip" {}
resource "outscale_nat_service" "outscale_nat_service" {
depends_on = ["outscale_route.outscale_route"]
subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}"
public_ip_id = "${outscale_public_ip.outscale_public_ip.public_ip_id}"
subnet_id = outscale_subnet.outscale_subnet.subnet_id
public_ip_id = outscale_public_ip.outscale_public_ip.public_ip_id
}
resource "outscale_route_table" "outscale_route_table" {
net_id = "${outscale_net.outscale_net.net_id}"
net_id = outscale_net.outscale_net.net_id
}
resource "outscale_route" "outscale_route" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/terraform-providers/terraform-provider-outscale/utils"
)

func TestAccDataSourceOutscaleOAPINetAccessPointServices_basic(t *testing.T) {
func TestAccNet_AccessPointServicesDataSource_basic(t *testing.T) {
t.Parallel()
serviceName := fmt.Sprintf("com.outscale.%s.api", utils.GetRegion())

Expand Down
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_net_access_point_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/terraform-providers/terraform-provider-outscale/utils"
)

func TestAccDataSourceOutscaleOAPINetAccessPoint_basic(t *testing.T) {
func TestAccNet_AccessPointDataSource_basic(t *testing.T) {
t.Parallel()
serviceName := fmt.Sprintf("com.outscale.%s.api", utils.GetRegion())

Expand Down
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_net_access_points_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/terraform-providers/terraform-provider-outscale/utils"
)

func TestAccDataSourceOutscaleOAPINetAccessPoints_basic(t *testing.T) {
func TestAccNet_AccessPointsDataSource_basic(t *testing.T) {
t.Parallel()
serviceName := fmt.Sprintf("com.outscale.%s.api", utils.GetRegion())

Expand Down
8 changes: 3 additions & 5 deletions outscale/data_source_outscale_net_attributes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

func TestAccOutscaleOAPIDSLinAttr_basic(t *testing.T) {
func TestAccNet_AttributesDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down Expand Up @@ -58,14 +58,12 @@ const testAccOutscaleOAPIDSLinAttrConfig = `
}
}
resource "outscale_net_attributes" "outscale_net_attributes" {
net_id = "${outscale_net.vpc.id}"
net_id = outscale_net.vpc.id
dhcp_options_set_id = outscale_net.vpc2.dhcp_options_set_id
}
data "outscale_net_attributes" "test" {
net_id = "${outscale_net.vpc.id}"
net_id = outscale_net.vpc.id
}
`
8 changes: 4 additions & 4 deletions outscale/data_source_outscale_net_peering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

func TestAccDataSourceOutscaleOAPILinPeeringConnection_basic(t *testing.T) {
func TestAccNet_PeeringConnectionDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down Expand Up @@ -68,14 +68,14 @@ const testAccDataSourceOutscaleOAPILinPeeringConnectionConfig = `
}
resource "outscale_net_peering" "net_peering" {
accepter_net_id = "${outscale_net.net.net_id}"
source_net_id = "${outscale_net.net2.net_id}"
accepter_net_id = outscale_net.net.net_id
source_net_id = outscale_net.net2.net_id
}
data "outscale_net_peering" "net_peering_data" {
filter {
name = "net_peering_ids"
values = ["${outscale_net_peering.net_peering.net_peering_id}"]
values = [outscale_net_peering.net_peering.net_peering_id]
}
}
`
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_net_peerings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestAccDataSourceOutscaleOAPILinPeeringsConnection_basic(t *testing.T) {
func TestAccNet_PeeringsConnectionDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
4 changes: 2 additions & 2 deletions outscale/data_source_outscale_net_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/terraform-providers/terraform-provider-outscale/utils"
)

func TestAccDataSourceOutscaleOAPIVpc_basic(t *testing.T) {
func TestAccNet_DataSource_basic(t *testing.T) {
t.Parallel()
rand.Seed(time.Now().UTC().UnixNano())
ipRange := utils.RandVpcCidr()
Expand Down Expand Up @@ -74,7 +74,7 @@ func testAccDataSourceOutscaleOAPIVpcConfig(ipRange, tag string) string {
data "outscale_net" "by_id" {
filter {
name = "net_ids"
values = ["${outscale_net.test.id}"]
values = [outscale_net.test.id]
}
}
`, ipRange, tag)
Expand Down
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_nets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/terraform-providers/terraform-provider-outscale/utils"
)

func TestAccDataSourceOutscaleOAPIVpcs_basic(t *testing.T) {
func TestAccNets_DataSource_basic(t *testing.T) {

rand.Seed(time.Now().UTC().UnixNano())
ipRange := utils.RandVpcCidr()
Expand Down
4 changes: 2 additions & 2 deletions outscale/data_source_outscale_nic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

func TestAccOutscaleOAPIENIDataSource_basic(t *testing.T) {
func TestAccNet_WithNicDataSource_basic(t *testing.T) {
t.Parallel()
var conf oscgo.Nic

Expand All @@ -36,7 +36,7 @@ func TestAccOutscaleOAPIENIDataSource_basic(t *testing.T) {
})
}

func TestAccOutscaleOAPIENIDataSource_basicFilter(t *testing.T) {
func TestAccNet_WithNicDataSource_basicFilter(t *testing.T) {
t.Parallel()
var conf oscgo.Nic

Expand Down
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_nics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/terraform-providers/terraform-provider-outscale/utils"
)

func TestAccOutscaleOAPINicsDataSource(t *testing.T) {
func TestAccNet_WithNicsDataSource(t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_route_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

func TestAccDataSourceOutscaleOAPIRouteTable_basic(t *testing.T) {
func TestAccNet_WithRouteTableDataSource_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand Down
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_route_tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestAccDataSourceOutscaleOAPIRouteTables_basic(t *testing.T) {
func TestAccNet_WithRouteTablesDataSource_basic(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
8 changes: 4 additions & 4 deletions outscale/data_source_outscale_security_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

func TestAccDataSourceOutscaleOAPISecurityGroup_basic(t *testing.T) {
func TestAccNet_WithSecurityGroupDataSource_basic(t *testing.T) {
t.Parallel()
rInt := acctest.RandInt()
resource.Test(t, resource.TestCase{
Expand All @@ -27,7 +27,7 @@ func TestAccDataSourceOutscaleOAPISecurityGroup_basic(t *testing.T) {
})
}

func TestAccDataSourceOutscaleOAPISecurityGroupPublic(t *testing.T) {
func TestAccNet_WithSecurityGroupPublic_(t *testing.T) {
t.Parallel()
rInt := acctest.RandInt()
resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -102,7 +102,7 @@ func testAccDataSourceOutscaleOAPISecurityGroupConfig(rInt int) string {
#data "outscale_security_group" "by_filter" {
# filter {
# name = "security_group_names"
# values = ["${outscale_security_group.test.security_group_name}"]
# values = [outscale_security_group.test.security_group_name]
# }
#}`, rInt, rInt)
}
Expand All @@ -123,7 +123,7 @@ func testAccDataSourceOutscaleOAPISecurityGroupPublicConfig(rInt int) string {
name = "security_group_names"
// name = "group_name"
values = ["${outscale_security_group.test.security_group_name}"]
values = [outscale_security_group.test.security_group_name]
}
}`, rInt, rInt)
}
2 changes: 1 addition & 1 deletion outscale/data_source_outscale_security_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestAccDataSourceOutscaleOAPISecurityGroups_vpc(t *testing.T) {
func TestAccNet_WIthSecurityGroups_DataSource(t *testing.T) {
rInt := acctest.RandInt()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
4 changes: 2 additions & 2 deletions outscale/data_source_outscale_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/terraform-providers/terraform-provider-outscale/utils"
)

func TestAccDataSourceOutscaleOAPISubnet(t *testing.T) {
func TestAccNet_WithSubnet_DataSource(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -26,7 +26,7 @@ func TestAccDataSourceOutscaleOAPISubnet(t *testing.T) {
})
}

func TestAccDataSourceOutscaleOAPISubnet_withAvailableIpsCountsFilter(t *testing.T) {
func TestAccNet_SubnetDataSource_withAvailableIpsCountsFilter(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
Loading

0 comments on commit 1044386

Please sign in to comment.