【发布时间】:2021-02-20 01:41:23
【问题描述】:
我正在尝试使用 F# 了解 pulumi,但我无法理解如何使用从一个资源发出的输出值最终进入另一个资源。这是我的具体情况:
let infra() =
let adminsName = "admins"
let current =
Output.Create<System.Threading.Tasks.Task<GetCallerIdentityResult>>(GetCallerIdentity.InvokeAsync()).Apply<GetCallerIdentityResult>(fun x->
x
|> Async.AwaitTask
|> Async.RunSynchronously
)
let adminRoleName = sprintf "%s-eksClusterAdmin" adminsName
let adminRolePolicy =
current.Apply(fun id ->
@"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Principal"": {
""AWS"": ""arn:aws:iam::" + id.AccountId + @":root""
},
""Effect"": ""Allow"",
""Sid"": """"
}
]
}"
)
let adminsIamRole =
Role (adminRoleName,
RoleArgs(AssumeRolePolicy= (adminRolePolicy.Apply(fun x -> x)))
)
我受到以下演练的极大启发,我正在尝试移植到 f#
https://www.pulumi.com/docs/guides/crosswalk/kubernetes/identity/#create-an-iam-role-for-admins
目前正在建设的项目告诉我:
iam.fs(47,45): error FS0001: The type 'Output<string>' is not compatible with the type 'Input<string>'
iam.fs(47,44): error FS0193: Type constraint mismatch. The type 'Output<string>' is not compatible with type 'Input<string>'
如何使用 pulumi 将输出转换为输入?
【问题讨论】:
-
我对此不太熟悉,但正在尝试重现编译器错误。你使用什么亚马逊包和命名空间?