sparse-midnight-5337
05/26/2022, 3:17 PMconst dict = service.dictionaries.apply(d => d?.[0].dictionaryId || '1234') // <--- This always returns undefined, so default to 1234
however because of the comment above whenever i run pulumi up
i get the following error.
Diagnostics:
fastly:index:ServiceDictionaryItems (CredentialsDict):
error: 1 error occurred:
* Error creating dictionary items: service 6JGsFBzFbONzfbcXDyfRP3, dictionary 1234, 400 - Bad Request:
Title: Bad request
Detail: Couldn't find Dictionary '{ dictionary_id => 1234, service_id => 6JGsFBzFbONzfbcXDyfRP3 }'
pulumi:pulumi:Stack (fastly-shell-dev):
error: update failed
Is it possible to retrieve this ID during the deployment process? If not how can I query this after the service is deployed and still able to deploy the dictionary at the same time?pulumi up
.
I fixed this issue by using dependsOn: [service]
when defining my dictionaryItems.
const MyComputeService = new ServiceCompute(...)
new fastly.ServiceDictionaryItems('MyDictionary', {
serviceId: service.id,
dictionaryId: MyComputeService.dictionaries.apply(d => d?.[0].dictionaryId || '1234'),
items: {
'item1': config.require('item1').toString(),
'item2': config.require('item2').toString()
}
}, {dependsOn: [MyComputeService]})