Skip to content

Instantly share code, notes, and snippets.

@martinjt
Created April 21, 2020 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinjt/d273643227c93715aea015015b688343 to your computer and use it in GitHub Desktop.
Save martinjt/d273643227c93715aea015015b688343 to your computer and use it in GitHub Desktop.
Output.Format usage in Pulumi
using System;
using System.Collections.Generic;
using Pulumi;
using Pulumi.Aws.DynamoDB;
using Pulumi.Aws.DynamoDB.Inputs;
using Pulumi.Aws.Iam;
namespace Demo
{
public class DemoStack : Stack
{
public DemoStack()
{
var demoTable = new Table("demo", new TableArgs
{
Attributes = new List<TableAttributeArgs> {
new TableAttributeArgs {
Name = "DemoId",
Type = "S"
}
},
HashKey = "DemoId",
});
Console.WriteLine(demoTable.Arn);
var policyDoc = Output.Format($@"{{
""Version"": ""2012-10-17"",
""Statement"": [
{{
""Effect"": ""Allow"",
""Action"": [
""dynamodb:*""
],
""Resource"": [
""{demoTable.Arn}"",
""{demoTable.Arn}/index/*""
]
}}
]
}}");
var editPolicy = new Policy("demo-dynamodb-edit", new PolicyArgs
{
PolicyDocument = policyDoc
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment