Git Product home page Git Product logo

pulumi-poc's Introduction

Overview

This is a simple control plan that manages a GCP firewall rule via Pulumi.

Demo

Once server is running, and underlying cloud infra has been created, curl /read to get state of firewall rule right now:

$ curl localhost:8080/read
2.2.2.0/24
 is allowed!

2.2.2.0/24 is not my public IP so pinging shouldn't work (firewall rule protocol = ICMP):

$ ping <public ip of cloud infra>
PING <public ip of cloud infra> (<public ip of cloud infra>): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
^C
--- <public ip of cloud infra> ping statistics ---
7 packets transmitted, 0 packets received, 100.0% packet loss

Now we get the control plane ready to write my public IP to the underlying GCP firewall:

$ curl localhost:8080/prepare -X POST --data "<my public ip>"
<my public ip> added!
$ curl localhost:8080/read
<my public ip>
 is allowed!
$ curl localhost:8080/diff
Here's the plan!
Previewing update (dev):
  pulumi:pulumi:Stack: (same)
...
Resources:
    ~ 1 to update
    3 unchanged
...

Plan looks good. Now we tell pulumi to execute it:

$ curl localhost:8080/write
Cloud provider updated!

Now we can ping!!

$ ping <public ip of cloud infra>
PING <public ip of cloud infra> (<public ip of cloud infra>): 56 data bytes
64 bytes from <public ip of cloud infra>: icmp_seq=0 ttl=56 time=59.500 ms
64 bytes from <public ip of cloud infra>: icmp_seq=1 ttl=56 time=151.206 ms
64 bytes from <public ip of cloud infra>: icmp_seq=2 ttl=56 time=55.875 ms

pulumi-poc's People

Contributors

joshimhoff avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.