Dan Anglin
f5c0c88c2e
The Pulumi stack was recreated and the codebase has been refactored. The platform's configuration is now defined in another repository and integrated into this project via a sub module. For now we've imported the domain and the domain records.
141 lines
3.7 KiB
Text
141 lines
3.7 KiB
Text
package main
|
|
|
|
import (
|
|
)
|
|
|
|
|
|
//type instanceOutput struct {
|
|
// ipv4 pulumi.StringOutput
|
|
// id pulumi.IntOutput
|
|
//}
|
|
|
|
//func instance(ctx *pulumi.Context) (instanceOutput, error) {
|
|
// var output instanceOutput
|
|
//
|
|
// cfg := config.New(ctx, "")
|
|
//
|
|
// region := cfg.Require("region")
|
|
// tags := []string{"flow"}
|
|
// instanceLabelID := "flow-platform"
|
|
// instanceType := "g6-standard-1"
|
|
//
|
|
// // TODO: finish instance arguments to completion
|
|
// instanceArgs := linode.InstanceArgs{
|
|
// BackupsEnabled: pulumi.Bool(false),
|
|
// Label: pulumi.String(instanceLabelID),
|
|
// PrivateIp: pulumi.Bool(false),
|
|
// Region: pulumi.String(region),
|
|
// Tags: pulumi.ToStringArray(tags),
|
|
// SwapSize: pulumi.Int(512),
|
|
// Type: pulumi.String(instanceType),
|
|
// WatchdogEnabled: pulumi.Bool(true),
|
|
// }
|
|
//
|
|
// instance, err := linode.NewInstance(ctx, instanceLabelID, &instanceArgs, pulumi.Protect(true))
|
|
// if err != nil {
|
|
// return output, fmt.Errorf("unable to update instance; %w", err)
|
|
// }
|
|
//
|
|
// instanceID := instance.ID().ToStringOutput().ApplyT(func(id string) (int, error) {
|
|
// return strconv.Atoi(id)
|
|
// }).(pulumi.IntOutput)
|
|
//
|
|
// output = instanceOutput{
|
|
// id: instanceID,
|
|
// ipv4: instance.IpAddress,
|
|
// }
|
|
//
|
|
// return output, nil
|
|
//}
|
|
|
|
//func volume(ctx *pulumi.Context, instanceID pulumi.IntInput) error {
|
|
// volumeLabelID := "flow-platform-volume"
|
|
//
|
|
// cfg := config.New(ctx, "")
|
|
//
|
|
// region := cfg.Require("region")
|
|
//
|
|
// tags := []string{"flow"}
|
|
//
|
|
// volumeArgs := linode.VolumeArgs{
|
|
// Label: pulumi.String(volumeLabelID),
|
|
// LinodeId: instanceID,
|
|
// Region: pulumi.String(region),
|
|
// Size: pulumi.Int(10),
|
|
// Tags: pulumi.ToStringArray(tags),
|
|
// }
|
|
//
|
|
// _, err := linode.NewVolume(ctx, volumeLabelID, &volumeArgs, pulumi.Protect(true))
|
|
// if err != nil {
|
|
// return fmt.Errorf("unable to update volume; %w", err)
|
|
// }
|
|
//
|
|
// return nil
|
|
//}
|
|
|
|
//func firewall(ctx *pulumi.Context, instanceID pulumi.IntOutput) error {
|
|
// allowHttp := linode.FirewallInboundArgs{
|
|
// Label: pulumi.String("accept-inbound-tcp-80"),
|
|
// Action: pulumi.String("ACCEPT"),
|
|
// Protocol: pulumi.String("TCP"),
|
|
// Ports: pulumi.String("80"),
|
|
// Ipv4s: pulumi.StringArray{
|
|
// pulumi.String("0.0.0.0/0"),
|
|
// },
|
|
// Ipv6s: pulumi.StringArray{
|
|
// pulumi.String("::/0"),
|
|
// },
|
|
// }
|
|
//
|
|
// allowHttps := linode.FirewallInboundArgs{
|
|
// Label: pulumi.String("accept-inbound-tcp-443"),
|
|
// Action: pulumi.String("ACCEPT"),
|
|
// Protocol: pulumi.String("TCP"),
|
|
// Ports: pulumi.String("443"),
|
|
// Ipv4s: pulumi.StringArray{
|
|
// pulumi.String("0.0.0.0/0"),
|
|
// },
|
|
// Ipv6s: pulumi.StringArray{
|
|
// pulumi.String("::/0"),
|
|
// },
|
|
// }
|
|
//
|
|
// tags := []string{"flow"}
|
|
//
|
|
// label := "fireflow"
|
|
//
|
|
// firewallArgs := linode.FirewallArgs{
|
|
// Label: pulumi.String(label),
|
|
// Tags: pulumi.ToStringArray(tags),
|
|
// InboundPolicy: pulumi.String("DROP"),
|
|
// Inbounds: linode.FirewallInboundArray{
|
|
// &allowHttp,
|
|
// &allowHttps,
|
|
// },
|
|
// OutboundPolicy: pulumi.String("ACCEPT"),
|
|
// Linodes: pulumi.IntArray{
|
|
// instanceID,
|
|
// },
|
|
// }
|
|
//
|
|
// _, err := linode.NewFirewall(ctx, label, &firewallArgs)
|
|
// if err != nil {
|
|
// return fmt.Errorf("unable to update the firewall; %w", err)
|
|
// }
|
|
//
|
|
// return nil
|
|
//}
|
|
|
|
//func main() {
|
|
// pulumi.Run(func(ctx *pulumi.Context) error {
|
|
// _, err := linode.NewDomainRecord(ctx, "root", &linode.DomainRecordArgs{
|
|
// DomainId: pulumi.Int(1297393),
|
|
// RecordType: pulumi.String("A"),
|
|
// Target: pulumi.String("213.52.130.52"),
|
|
// }, pulumi.Protect(true))
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// return nil
|
|
// })
|
|
//}
|