Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vpc-gw): add support for enable_smtp #1357

Merged
merged 2 commits into from
Jul 5, 2022
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 @@ -32,6 +32,7 @@ The following arguments are supported:
- `ip_id` - (Optional) attach an existing flexible IP to the gateway
- `bastion_enabled` - (Optional) Enable SSH bastion on the gateway
- `bastion_port` - (Optional) The port on which the SSH bastion will listen.
- `enable_smtp` - (Optional) Enable SMTP on the gateway

## Attributes Reference

Expand Down
12 changes: 12 additions & 0 deletions scaleway/resource_vpc_public_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ func resourceScalewayVPCPublicGateway() *schema.Resource {
Optional: true,
Computed: true,
},
"enable_smtp": {
Type: schema.TypeBool,
Description: "Enable SMTP on the gateway",
Optional: true,
Computed: true,
},
"project_id": projectIDSchema(),
"zone": zoneSchema(),
// Computed elements
Expand Down Expand Up @@ -106,6 +112,7 @@ func resourceScalewayVPCPublicGatewayCreate(ctx context.Context, d *schema.Resou
ProjectID: d.Get("project_id").(string),
EnableBastion: d.Get("bastion_enabled").(bool),
Zone: zone,
EnableSMTP: d.Get("enable_smtp").(bool),
}

if bastionPort, ok := d.GetOk("bastion_port"); ok {
Expand Down Expand Up @@ -158,6 +165,7 @@ func resourceScalewayVPCPublicGatewayRead(ctx context.Context, d *schema.Resourc
_ = d.Set("ip_id", newZonedID(gateway.Zone, gateway.IP.ID).String())
_ = d.Set("bastion_enabled", gateway.BastionEnabled)
_ = d.Set("bastion_port", int(gateway.BastionPort))
_ = d.Set("enable_smtp", gateway.SMTPEnabled)

return nil
}
Expand Down Expand Up @@ -194,6 +202,10 @@ func resourceScalewayVPCPublicGatewayUpdate(ctx context.Context, d *schema.Resou
updateRequest.EnableBastion = scw.BoolPtr(d.Get("enable_bastion").(bool))
}

if d.HasChange("enable_smtp") {
updateRequest.EnableSMTP = scw.BoolPtr(d.Get("enable_smtp").(bool))
}

if d.HasChange("upstream_dns_servers") {
updateRequest.UpstreamDNSServers = expandUpdatedStringsPtr(d.Get("upstream_dns_servers"))
}
Expand Down