best-receptionist-98400
05/27/2020, 6:16 PMvar spotOutput = Pulumi.Aws.Ec2.SpotInstanceRequest.Get(spotRequest.GetResourceName(), spotRequest.Id, null, new CustomResourceOptions
{
DependsOn = spotRequest
});
But it keeps giving me an error: of
aws:ec2:SpotInstanceRequest (dev-request-1):
error: resource 'urn:pulumi:dev::aws-spot::aws:ec2/spotInstanceRequest:SpotInstanceRequest::dev-request-1' registered twice (create and read)
error: resource 'urn:pulumi:dev::aws-spot::aws:ec2/spotInstanceRequest:SpotInstanceRequest::dev-request-1' registered twice (create and read)
gentle-diamond-70147
05/27/2020, 7:16 PM.Get(spotRequest.GetResourceName(), ...
to a different value to avoid that error.best-receptionist-98400
05/27/2020, 8:31 PMvar spotOutput = Output.Create(Pulumi.Aws.Ec2.SpotInstanceRequest.Get($"{spotRequest.GetResourceName()}-{i}", spotRequest.Id, null, new CustomResourceOptions
{
DependsOn = spotRequest
}));
Console.WriteLine($"{spotOutput.Apply(x => x.SpotInstanceId)}");
And
var spotOutput = Pulumi.Aws.Ec2.SpotInstanceRequest.Get($"{spotRequest.GetResourceName()}-{i}", spotRequest.Id, null, new CustomResourceOptions
{
DependsOn = spotRequest
});
Console.WriteLine($"{spotOutput.SpotInstanceId.Apply(x => x)}");
gentle-diamond-70147
05/27/2020, 8:40 PMspotOutput.SpotInstanceId.Apply(x => Console.WriteLine(x));
?
Apologies, C# isn't my go-to language, but that's how you would do it in one of the other languages.best-receptionist-98400
05/27/2020, 8:44 PMgentle-diamond-70147
05/27/2020, 8:52 PMbest-receptionist-98400
05/27/2020, 8:54 PMgentle-diamond-70147
05/27/2020, 9:51 PMbroad-dog-22463
05/27/2020, 9:55 PMbest-receptionist-98400
05/27/2020, 9:56 PMbroad-dog-22463
05/27/2020, 10:03 PMbest-receptionist-98400
05/27/2020, 10:16 PMtall-librarian-49374
05/28/2020, 6:31 AMbest-receptionist-98400
05/28/2020, 1:59 PMDependsOn
on the SpotInstanceRequest.Get
? I've run this a few times this morning and it's always worked the first try. I'm assuming because I have the DependsOn as well as the WaitForFulfillment
set on the initial spot request?
Or am I just getting lucky that the value has always been ready the first time?tall-librarian-49374
05/28/2020, 2:00 PMbest-receptionist-98400
05/28/2020, 2:05 PMSpotInstanceId
is there before running the SDK operation.