Skip to content

Instantly share code, notes, and snippets.

@omarismail
Last active September 18, 2023 18:06
Show Gist options
  • Save omarismail/3c24e318412acbcaf042e44c2054bf4e to your computer and use it in GitHub Desktop.
Save omarismail/3c24e318412acbcaf042e44c2054bf4e to your computer and use it in GitHub Desktop.
provider-functions
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}
locals {
arn_parts = provider::aws::parse_arn("arn:aws:s3:::examplebucket/developers/design_info.doc")
}
output "arn_service" {
value = local.arn_parts.service
}
# Another ex: provider::time::iso8601(time_static.example.rfc3339)
@omarismail
Copy link
Author

Looks good, but would it support default/mandatory parameters values?

The arguments defined by the provider function declaration will all be required arguments to pass into the function call. There won't be the notion of optional values, at least at in the beginning.

Can parameters be passed from resource, data output blocks? or variables?

Yes

Would dependencies work with functions? For example if I need the output of a function to be used somewhere else like a resource block.

Yes

Also, we do not need to set the output type. I am assuming it inherits based on the function output?

No, the output type is defined by the Provider Function definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment