This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IHostBuilder CreateHostBuilder(string[] args) | |
{ | |
var processStartTime = DateTimeOffset.Now; | |
return Host.CreateDefaultBuilder(args) | |
.ConfigureServices((hostContext, services) => | |
{ | |
services.AddHostedService<Worker>(); | |
services.AddBasicTinyHealthCheckWithUptime(config => | |
{ | |
config.Port = 8081; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: "2010-09-09" | |
Description: AWS CloudFormation template to launch an AmazonMQ(RabbitMQ) instance. Specifying anything larger than mq.t3.micro will deploy a cluster instead of a single-instance. | |
Parameters: | |
ClusterName: | |
Description: The name of the RabbitMQ Cluster | |
Type: String | |
MinLength: 8 | |
MaxLength: 50 | |
Subnets: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data.Common; | |
using System.Text.RegularExpressions; | |
using Amazon.Runtime.Internal.Util; | |
using Amazon.XRay.Recorder.Core; | |
using System.Configuration; | |
// copied from https://github.com/aws/aws-xray-sdk-dotnet/blob/d2b64125ecdd734af220795d5b102bd96b037981/sdk/src/Handlers/EntityFramework/EFUtil.cs#L58 | |
// Xray doesn't support EF5 OOTB right now, so this lets us hack it back in | |
// code is a little hacked up to get support working without having to drag in a bunch of internal deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore.Diagnostics; | |
using System.Data.Common; | |
using System.Threading; | |
using System.Threading.Tasks; | |
// copied from https://github.com/aws/aws-xray-sdk-dotnet/blob/master/sdk/src/Handlers/EntityFramework/EFInterceptor.cs | |
// Xray doesn't support EF5 OOTB right now, so this lets us hack it back in. | |
// All we did was change all the Task<> to ValueTask<> | |
namespace MyProject.Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_ecs_task_definition" "bastion" { | |
family = "${var.base_name}-bastion-task" | |
network_mode = "awsvpc" | |
requires_compatibilities = ["FARGATE"] | |
cpu = 256 | |
memory = 512 | |
execution_role_arn = aws_iam_role.ecs_task_execution_role.arn | |
container_definitions = jsonencode([{ | |
name = "bastion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module "secrets" { | |
source = "./secrets" | |
base_name = local.base_name | |
default_tags = local.default_tags | |
secret_map = { | |
"shared/bastion/ssh/public_pem" = tls_private_key.bastion.public_key_openssh | |
"shared/bastion/ssh/private_pem" = tls_private_key.bastion.private_key_pem | |
"shared/bastion/ssh/username" = random_pet.bastion_username.id | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "base_name" { | |
description = "The prefix on created resources" | |
} | |
variable "secret_map" { | |
description = "A Key/Value map of secrets that will be added to AWS Secrets" | |
type = map(string) | |
} | |
variable "default_tags" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using FluentValidation; | |
using System.Text.Json; | |
using System.Threading.Tasks; | |
using Logic.Exceptions; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.Hosting; | |
using System.Linq; | |
using System.Collections.Generic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Azure.Identity; | |
using Azure.ResourceManager.Resources; | |
using MyFunctionProject.Models; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Extensions.Options; | |
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string]$workspaceName = $(throw "Please specify a workspace name"), | |
[string]$organizationName = $(throw "Please specify an organization name"), | |
[string]$terraformIoToken = $(throw "Please specify a terraform Io Token") | |
) | |
$ErrorActionPreference = "Stop" | |
$baseUri = "https://app.terraform.io/" | |
$authHeader = @{ Authorization = "Bearer $terraformIoToken" } |