Skip to content

Instantly share code, notes, and snippets.

@spettifer
spettifer / application-insights.tf
Last active July 8, 2021 15:07
Workaround for application insights instances created using Terraform AzureRM provider v1.x when upgrading to v2.0
# The application_type attribute is now case senstive. If the resource has been previously created with provider v1.x and the
# application_type was not lower case, then changing it to suit the v2 provider will result in the resource being destroyed
# and re-created since there is no way to update this value in place
# (see https://github.com/terraform-providers/terraform-provider-azurerm/issues/5902).
# To prevent this, add a lifecycle customisation and specify application_type as an attribute to ignore. Any attribute specified
# in the ignore_changes array will not be considered when creating a plan for an update, but they will still be part of creating
# a new resource.
resource "azurerm_application_insights" "appinsights" {
@spettifer
spettifer / ContrivedUnitTestWithCloudTable.cs
Last active February 13, 2020 17:44
A very contrived example of using a test double for CloudTable using NSubstitute in a unit test
// This is not runnable as is, but shows the basic principle. Note that the cloud table test double is being used as a stub,
// not a spy or a mock, although it could fulfill either of those roles with additional setup if required.
[Fact]
public async Task ExampleUnitTestWithCloudTableTestDouble()
{
var testResult = new TableResult
{
Result = new MyEntity()
{
ETag = "*",