I am trying to get my head around pulumi using F# but I am unable to understand how to use Output values issued from one resource eventually into another resource. Here my specific case :
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)))
)
I have been heavily inspired by the following walkthrough that I am trying to port to f#
https://www.pulumi.com/docs/guides/crosswalk/kubernetes/identity/#create-an-iam-role-for-admins
Currently building the project tells me :
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>'
How can I cast Output into Input with pulumi ?
There is a helper function io
to convert an output to an input
AssumeRolePolicy = io adminRolePolicy
You need to reference the Pulumi.FSharp
NuGet package.
See io
source and a usage example.