Skip to content

Instantly share code, notes, and snippets.

View mikhailshilkov's full-sized avatar

Mikhail Shilkov mikhailshilkov

View GitHub Profile

Does Pulumi help you to migrate resources from one cloud to another?

Not really… We don’t not have active “cross-cloud” solutions (except things like Kubernetes), resources are defined in terms that are specific to each cloud (S3 / Azure Storage, not “Storage”). Migration may be easier because it’s the same tool that you use, but the program is going to be different.

Does pulumi detect circular dependencies?

You can’t make circular dependencies by design. To depend B on A, you need to define A in your program before B, which is not possible.

What about security of sensitive information like passwords, certificates, etc.?

module Program
open Pulumi.FSharp
open Pulumi.Azure.Core
open Pulumi.Azure.Network
open Pulumi.Azure.Network.Inputs
open Pulumi.Azure.Storage
let infra () =
// Create an Azure Resource Group
@mikhailshilkov
mikhailshilkov / after.MyStack.cs
Created February 7, 2020 13:30
.NET API change
using Pulumi;
using Pulumi.Serialization;
using Pulumi.Azure.Core;
using Pulumi.Azure.Storage;
class MyStack : Stack
{
public MyStack()
{
// Create an Azure Resource Group
@mikhailshilkov
mikhailshilkov / ec2tests.ts
Created February 1, 2020 09:34
Pulumi TS tests
import * as assert from "assert";
import "mocha";
import * as pulumi from "@pulumi/pulumi";
pulumi.runtime.setMocks({
newResource: function(type: string, name: string, inputs: any) : {id: string, state: any} {
switch (type) {
case "aws:ec2/securityGroup:SecurityGroup":
return {
id: "sg-12345678",
{
"version": 3,
"checkpoint": {
"stack": "dev",
"latest": {
"manifest": {
"time": "2020-01-20T08:47:49.474534+01:00",
"magic": "bb521ffde7f66189372608dff592cf5e0755a8d51c960dc6567ed5b42329a1ac",
"version": "v1.8.1"
},
@mikhailshilkov
mikhailshilkov / Stack.cs
Last active January 17, 2020 02:31
Mock-based unit tests examples in C#
class MyStack : Stack
{
public MyStack()
{
var group = new SecurityGroup("web-secgrp", new SecurityGroupArgs
{
Ingress =
{
new SecurityGroupIngressArgs { Protocol = "tcp", FromPort = 22, ToPort = 22, CidrBlocks = {"0.0.0.0/0" } },
new SecurityGroupIngressArgs { Protocol = "tcp", FromPort = 80, ToPort = 80, CidrBlocks = {"0.0.0.0/0" } }
class ComponentData
{
[Output("connectionString")]
public Output<string>? ConnectionString { get; set; }
[Output("subscriptionId")]
public Output<string>? SubscriptionId { get; set; }
}
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const corsApi = new aws.apigateway.RestApi("cors_api", {
description: "An API for demonstrating CORS-enabled methods.",
name: "MyAPI",
});
const corsResource = new aws.apigateway.Resource("cors_resource", {
parentId: corsApi.rootResourceId,
pathPart: "Employee",
provider "azurerm" {
version = "~> 1.35"
}
resource "azurerm_resource_group" "test" {
name = "resourceGroup1"
location = "westeurope"
}