Resource with File Uploads

Hi. So this is for developing a provider with the v2 sdk.

So I’m trying to define a custom resource but aside from the JSON configuration, the resource will eventually need a file uploaded to it. The target API supports all this uploading, but I’m wondering how this would work with Terraform config files.

I’m thinking of including a filename/path in the resource field but that doesn’t really make sense because the object in cloud does not have that property.

I’ve been looking at provisioners and it would be nice if the “file” provisioner functionality can be modified based on the custom resource type, but I haven’t really seen a documentation about it so that might not be possible.

Is this merely impossible for a provider and should it just be done with local-exec provisioners in the terraform configuration side?

This seems vaguely similar to what the aws_lambda_function resource does, which just accepts the filename.

1 Like