Skip to content

Instantly share code, notes, and snippets.

@martinjt

martinjt/DemoStack.cs Secret

Created Apr 21, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.