github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/aws-iam-policy-pp/dotnet/aws-iam-policy.cs (about)

     1  using System.Collections.Generic;
     2  using System.Text.Json;
     3  using Pulumi;
     4  using Aws = Pulumi.Aws;
     5  
     6  return await Deployment.RunAsync(() => 
     7  {
     8      // Create a policy with multiple Condition keys
     9      var policy = new Aws.Iam.Policy("policy", new()
    10      {
    11          Path = "/",
    12          Description = "My test policy",
    13          PolicyDocument = JsonSerializer.Serialize(new Dictionary<string, object?>
    14          {
    15              ["Version"] = "2012-10-17",
    16              ["Statement"] = new[]
    17              {
    18                  new Dictionary<string, object?>
    19                  {
    20                      ["Effect"] = "Allow",
    21                      ["Action"] = "lambda:*",
    22                      ["Resource"] = "arn:aws:lambda:*:*:function:*",
    23                      ["Condition"] = new Dictionary<string, object?>
    24                      {
    25                          ["StringEquals"] = new Dictionary<string, object?>
    26                          {
    27                              ["aws:RequestTag/Team"] = new[]
    28                              {
    29                                  "iamuser-admin",
    30                                  "iamuser2-admin",
    31                              },
    32                          },
    33                          ["ForAllValues:StringEquals"] = new Dictionary<string, object?>
    34                          {
    35                              ["aws:TagKeys"] = new[]
    36                              {
    37                                  "Team",
    38                              },
    39                          },
    40                      },
    41                  },
    42              },
    43          }),
    44      });
    45  
    46      return new Dictionary<string, object?>
    47      {
    48          ["policyName"] = policy.Name,
    49      };
    50  });
    51