andrewbaxter / terraform-provider-fly

Terraform provider for the Fly.io API
https://registry.terraform.io/providers/andrewbaxter/fly/latest
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

feature: add `start_port`, `end_port` to `fly_machine.services.ports` #10

Closed oscarhermoso closed 1 month ago

oscarhermoso commented 1 month ago

Fixes #11

Changes

Tested locally:

Screenshot from 2024-10-06 19-10-57

Dump of logs:

Logs

``` scarhermoso@pop-os:~/Git/kedyou-infra/fly$ tf apply ╷ │ Warning: Provider development overrides are in effect │ │ The following provider development overrides are set in the CLI configuration: │ - oscarhermoso/binarylane in /home/oscarhermoso/Git/terraform-provider-binarylane/bin │ - andrewbaxter/fly in /home/oscarhermoso/Git/terraform-provider-fly/bin │ │ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases. ╵ data.cloudflare_zone.prd: Reading... data.cloudflare_zone.dev: Reading... module.stripe_sync_dev.fly_app.app: Refreshing state... [id=stripe-sync-dev] module.coturn_dev_syd.fly_app.app: Refreshing state... [id=kedyou-coturn-dev] module.room_thumbnailer_dev.fly_app.app: Refreshing state... [id=room-thumbnailer-dev] data.cloudflare_zone.dev: Read complete after 1s [id=eae3f22077b9a8e7ff6368baa54855b3] module.coturn_dev_syd.data.cloudflare_zone.app: Reading... module.room_thumbnailer_dev.data.cloudflare_zone.app: Reading... module.stripe_sync_dev.data.cloudflare_zone.app: Reading... module.coturn_dev_syd.fly_ip.ipv4[0]: Refreshing state... [id=ip_ly4m2nlnez39k3oe] module.coturn_dev_syd.fly_cert.app[0]: Refreshing state... [id=cert_53l1jn] data.cloudflare_zone.prd: Read complete after 1s [id=ea249c57f72555882464ced52d6b9201] module.coturn_dev_syd.data.cloudflare_zone.app: Read complete after 0s [id=eae3f22077b9a8e7ff6368baa54855b3] module.room_thumbnailer_dev.fly_cert.app[0]: Refreshing state... [id=cert_0mlwy1] module.room_thumbnailer_dev.fly_ip.ipv6[0]: Refreshing state... [id=ip_4jq72jpxpd72w3o8] module.room_thumbnailer_dev.fly_ip.ipv4[0]: Refreshing state... [id=ip_60ow9qg3gd72kq4m] module.stripe_sync_dev.fly_cert.app[0]: Refreshing state... [id=cert_qxnqqy] module.stripe_sync_dev.terraform_data.app_secrets[0]: Refreshing state... [id=659321d7-3271-425f-efa2-cf397e8158fa] module.stripe_sync_dev.fly_ip.ipv6[0]: Refreshing state... [id=ip_qr702pllnkg136zd] module.coturn_dev_syd.cloudflare_record.ipv4[0]: Refreshing state... [id=c8d67dd59e8c0460023450eb865003d7] module.room_thumbnailer_dev.data.cloudflare_zone.app: Read complete after 0s [id=eae3f22077b9a8e7ff6368baa54855b3] module.room_thumbnailer_dev.cloudflare_record.ipv4[0]: Refreshing state... [id=ba4d1008eccc1f317fa80695bc810571] module.stripe_sync_dev.data.cloudflare_zone.app: Read complete after 1s [id=eae3f22077b9a8e7ff6368baa54855b3] module.stripe_sync_dev.cloudflare_record.ipv6[0]: Refreshing state... [id=1e9dddfe63e4b40699db3377e023cc09] module.room_thumbnailer_dev.cloudflare_record.ipv6[0]: Refreshing state... [id=b15696e09b90134a530f1e309f2d626b] module.room_thumbnailer_dev.cloudflare_record.dnsvalidation[0]: Refreshing state... [id=1f9418e91255bb950b4ba535d4f541f1] module.coturn_dev_syd.cloudflare_record.dnsvalidation[0]: Refreshing state... [id=9ad5aff2fd9437b9720e4a4247da6732] module.stripe_sync_dev.cloudflare_record.dnsvalidation[0]: Refreshing state... [id=97389ceec3f978a74adda5b9966b7faa] Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # module.stripe_sync_dev.fly_machine.app["syd"] will be created + resource "fly_machine" "app" { + app = "stripe-sync-dev" + auto_destroy = false + cpu_type = (known after apply) + cpus = 1 + env = { + "AUTO_EXPAND_LISTS" = "true" + "PORT" = "8080" } + id = (known after apply) + image = "supabase/stripe-sync-engine" + memory = 256 + name = "stripe-sync-dev-syd" + private_ip = (known after apply) + region = "syd" + services = [ + { + internal_port = 8080 + ports = [ + { + end_port = 80 + force_https = false + handlers = [ + "http", ] + start_port = 80 }, + { + end_port = 443 + force_https = false + handlers = [ + "tls", + "http", ] + start_port = 443 }, ] + protocol = "tcp" }, ] } Plan: 1 to add, 0 to change, 0 to destroy. Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes module.stripe_sync_dev.fly_machine.app["syd"]: Creating... module.stripe_sync_dev.fly_machine.app["syd"]: Still creating... [10s elapsed] module.stripe_sync_dev.fly_machine.app["syd"]: Still creating... [20s elapsed] module.stripe_sync_dev.fly_machine.app["syd"]: Creation complete after 21s [id=568303d3f0e718] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ```

andrewbaxter commented 1 month ago

Awesome, thanks for adding this! The changes look great.

andrewbaxter commented 1 month ago

I released this as 0.1.17! Thanks for setting the github issue meta too, that made things a lot easier.