SecurityHub Invitees Count

Hi,

Is there a way to programmatically retrieve a count of all the invitees invited into a securityhub service on AWS via Terraform?

Best Regards

Hi @Ntando-Mng at the time of this writing, there is no data resources available to query invitations for the security hub service. That being said, depending on your workflow, there are a few options tat come to mind, but again you need to determine if these are available options.

NOTE: The options below might not work due to how these values are consumed by Terraform. See this thread.

In no particular order:

  1. You could use the Terraform HTTP provider and query the ListInvitations API endpoint from AWS. That being said, you would have to provide a valid Signature V4 and provide that to the HTTP Terraform provider. Otherwise the query will fail due to authentication. This could get complicated very quickly.

  2. You could use a null_resource with a local-exec and use the AWS CLI. You could then pipe the results into a file (of type JSON). That file could then be read in by terraform through the provider local-file. Take a peek at this community article for an example.

  3. Get the list of invitees outside of Terraform. You could use the AWS CLI, or the AWS API, generate a JSON list and store it in a file. When the Terraform run starts you can use the provider local-file and read the content of that file and store it as a local variable.

These are just some options that come to top of mind.

Hi Karl,

Thank you so much for getting back to me and please forgive my delayed response.

I have not yet had the chance to continue this, but I will revert back if I have any updates.