2
2
using Iam = Pulumi . Aws . Iam ;
3
3
using Log = Pulumi . Log ;
4
4
using System . Collections . Generic ;
5
- using System . Text . Json ;
6
- using System . Text . Json . Serialization ;
7
5
8
6
class CreateRoleStack : Stack
9
7
{
@@ -25,11 +23,8 @@ public CreateRoleStack()
25
23
// https://www.pulumi.com/docs/intro/concepts/resources/#additionalsecretoutputs
26
24
new CustomResourceOptions { AdditionalSecretOutputs = { "secret" } } ) ;
27
25
28
- var tempPolicy = unprivilegedUser . Arn . Apply ( ( string arn ) =>
29
- {
30
- AssumeRolePolicyArgs policyArgs = new AssumeRolePolicyArgs ( arn ) ;
31
- return JsonSerializer . Serialize < AssumeRolePolicyArgs > ( policyArgs ) ;
32
- } ) ;
26
+ AssumeRolePolicyArgs policyArgs = new AssumeRolePolicyArgs ( unprivilegedUser . Arn ) ;
27
+ var tempPolicy = Output . JsonSerialize < AssumeRolePolicyArgs > ( policyArgs ) ;
33
28
34
29
var allowS3ManagementRole = new Iam . Role ( "allow-s3-management" , new Iam . RoleArgs
35
30
{
@@ -63,7 +58,7 @@ public class AssumeRolePolicyArgs
63
58
public string Version => "2012-10-17" ;
64
59
public StatementArgs Statement { get ; private set ; }
65
60
66
- public AssumeRolePolicyArgs ( string arn )
61
+ public AssumeRolePolicyArgs ( Input < string > arn )
67
62
{
68
63
Statement = new StatementArgs ( arn ) ;
69
64
}
@@ -77,25 +72,22 @@ public class StatementArgs
77
72
public PrincipalArgs Principal { get ; private set ; }
78
73
public string Action => "sts:AssumeRole" ;
79
74
80
- public StatementArgs ( string arn )
75
+ public StatementArgs ( Input < string > arn )
81
76
{
82
77
Principal = new PrincipalArgs ( arn ) ;
83
78
}
84
79
}
85
80
86
81
public class PrincipalArgs
87
82
{
88
- public string AWS { get ; private set ; }
83
+ public Input < string > AWS { get ; private set ; }
89
84
90
- public PrincipalArgs ( string arn )
85
+ public PrincipalArgs ( Input < string > arn )
91
86
{
92
87
AWS = arn ;
93
88
}
94
89
}
95
90
96
-
97
-
98
-
99
91
[ Output ]
100
92
public Output < string > roleArn { get ; set ; }
101
93
[ Output ]
0 commit comments