cold-toothbrush-60276
10/23/2021, 7:57 PMbored-table-20691
10/24/2021, 3:26 AMcold-toothbrush-60276
10/24/2021, 9:57 AMfunc linkResourcesToProject(ctx *plm.Context, prj *do.Project, resources *plm.StringArray) error {
reference := fmt.Sprintf("%s-resource", prj.Name)
_, err := do.NewProjectResources(ctx, reference, &do.ProjectResourcesArgs{
Project: prj.ID().ToStringOutput(),
Resources: resources,
})
return err
}
billowy-army-68599
10/24/2021, 3:53 PMdo.Project
with a string, so you should already know the value, so use a string
cold-toothbrush-60276
10/25/2021, 8:20 AMbillowy-army-68599
10/25/2021, 11:54 AMresource "digital_ocean_project" "my_project" {
}
you could not build my_project
dynamically in this case, as you're building the resource and it must have a known namecold-toothbrush-60276
10/25/2021, 11:55 AMbillowy-army-68599
10/25/2021, 11:58 AMfor_each
you end up needing to specify a specific name, and then also referencing the value with dependencies using the array element
In addition, terraform essentially compiles down to json, which is a different working mechanism to Pulumi. We don't transpile to a configuration languagecold-toothbrush-60276
10/25/2021, 11:59 AMbillowy-army-68599
10/25/2021, 12:00 PMcold-toothbrush-60276
10/25/2021, 12:02 PM