This file contains hidden or 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 override void Configure(IFunctionsHostBuilder builder) | |
| { | |
| ... | |
| builder.Services.AddLogging(); | |
| //workaround azure functions not handling nested arrays by default | |
| builder.Services.AddTransient<IConfigureOptions<MvcOptions>, MvcJsonMvcOptionsSetup>(); | |
| builder.Services.AddTransient<BaseValidator<Widget>, WidgetValidator>(o => new WidgetValidator()); | |
| builder.Services.AddTransient<BaseValidator<User>, UserValidator>(o => new UserValidator()); |
This file contains hidden or 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
| $Fields = @{ | |
| grant_type = "client_credentials" | |
| client_id = "<service-principal-id>" | |
| resource = "<resource-id-to-auth-for-or-url>" | |
| client_secret = "<service-principal-secret>" | |
| }; | |
| $response = Invoke-RestMethod ` | |
| -Uri "https://login.microsoftonline.com/<azure-tenant-id>/oauth2/token" ` | |
| -ContentType "application/x-www-form-urlencoded" ` | |
| -Method POST ` |
This file contains hidden or 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
| 2020-05-01T19:06:05.0948538Z ##[error]Publishing to database '****' on server '***.database.windows.net,1433'. | |
| Initializing deployment (Start) | |
| Initializing deployment (Failed) | |
| Time elapsed 00:00:06.91 | |
| *** An error occurred during deployment plan generation. Deployment cannot continue. The Element class SqlColumnStoreIndex does not contain the Relationship class OrderedColumns. |
This file contains hidden or 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" } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |