Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/vpc_public_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ In addition to all above arguments, the following attributes are exported:
- `organization_id` - The organization ID the public gateway is associated with.
- `created_at` - The date and time of the creation of the public gateway.
- `updated_at` - The date and time of the last update of the public gateway.
- `status` - The status of the public gateway.

## Import

Expand Down
7 changes: 7 additions & 0 deletions scaleway/resource_vpc_public_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ func resourceScalewayVPCPublicGateway() *schema.Resource {
Computed: true,
Description: "The date and time of the last update of the public gateway",
},
"status": {
Type: schema.TypeString,
Computed: true,
Description: "The status of the public gateway",
},
},
}
}
Expand Down Expand Up @@ -156,6 +161,8 @@ func resourceScalewayVPCPublicGatewayRead(ctx context.Context, d *schema.Resourc
}

_ = d.Set("name", gateway.Name)
_ = d.Set("type", gateway.Type.Name)
_ = d.Set("status", gateway.Status.String())
_ = d.Set("organization_id", gateway.OrganizationID)
_ = d.Set("project_id", gateway.ProjectID)
_ = d.Set("created_at", gateway.CreatedAt.Format(time.RFC3339))
Expand Down
19 changes: 10 additions & 9 deletions scaleway/resource_vpc_public_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,10 @@ func TestAccScalewayVPCPublicGateway_Basic(t *testing.T) {
}
`, publicGatewayName),
Check: resource.ComposeTestCheckFunc(
testAccCheckScalewayVPCPublicGatewayExists(
tt,
"scaleway_vpc_public_gateway.main",
),
resource.TestCheckResourceAttr(
"scaleway_vpc_public_gateway.main",
"name",
publicGatewayName,
),
testAccCheckScalewayVPCPublicGatewayExists(tt, "scaleway_vpc_public_gateway.main"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "name", publicGatewayName),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "type", "VPC-GW-S"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "status", vpcgw.GatewayStatusRunning.String()),
),
},
{
Expand All @@ -82,6 +77,8 @@ func TestAccScalewayVPCPublicGateway_Basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckScalewayVPCPublicGatewayExists(tt, "scaleway_vpc_public_gateway.main"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "name", publicGatewayName+"-new"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "type", "VPC-GW-S"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "status", vpcgw.GatewayStatusRunning.String()),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "tags.0", "tag0"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "tags.1", "tag1"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "upstream_dns_servers.0", "1.2.3.4"),
Expand All @@ -99,6 +96,8 @@ func TestAccScalewayVPCPublicGateway_Basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckScalewayVPCPublicGatewayExists(tt, "scaleway_vpc_public_gateway.main"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "name", publicGatewayName+"-zone"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "type", "VPC-GW-S"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "status", vpcgw.GatewayStatusRunning.String()),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "zone", "nl-ams-1"),
),
},
Expand All @@ -113,6 +112,8 @@ func TestAccScalewayVPCPublicGateway_Basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckScalewayVPCPublicGatewayExists(tt, "scaleway_vpc_public_gateway.main"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "name", publicGatewayName+"-zone-to-update"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "type", "VPC-GW-S"),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "status", vpcgw.GatewayStatusRunning.String()),
resource.TestCheckResourceAttr("scaleway_vpc_public_gateway.main", "zone", "nl-ams-1"),
),
},
Expand Down
Loading