-
-
Save martinjt/d273643227c93715aea015015b688343 to your computer and use it in GitHub Desktop.
Output.Format usage in Pulumi
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.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