Splunk Search

How to generate an API key/auth token to use for testing dashboard creation with terraform?

MuhammadMurad
Explorer

We are trying to generate an  API keys in order for Terraform to create dashboards. Anyone had idea on getting/have example on the API's keys?

Thank you.  

Labels (1)
Tags (1)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

That document is about creation of auth token.  Once created, you can follow Use authentication tokens to embed the token in Terraform or any other program.  In the example you give, instead of "-u {username:password}", use

-H "Authorization: <type> <token>"

 (I haven't used <type> in my queries, so read the document:-)

View solution in original post

0 Karma

MuhammadMurad
Explorer

Sorry if i was not clear. we are looking into automating the creation and updating of our  Splunk dashboards that requires API keys in order for Terraform to create dashboards. Was links that been shared was the correct one to follow? Below are some API keys we able to create, however not sure whether its good or not. Need your expert advise on this. Thanks in advance. 

curl -X POST -k -u {username:password} -H "Content-Type: application/json" \
"https://xxxxxxxxxxxxxxxx/http" \
--data-raw '{"name":"{hec-token-name}","index":"{index_name}","indexes":"{list_of_indexes}"}'

0 Karma

yuanliu
SplunkTrust
SplunkTrust

That document is about creation of auth token.  Once created, you can follow Use authentication tokens to embed the token in Terraform or any other program.  In the example you give, instead of "-u {username:password}", use

-H "Authorization: <type> <token>"

 (I haven't used <type> in my queries, so read the document:-)

0 Karma

MuhammadMurad
Explorer

Thank you. Yes the documents really helpful and we are exploring and testing it now. did not resolve it yet but we are in the right direction. Thanks. 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Not sue what the question is.  Do you mean how to generate an API key like this one: Create authentication tokens?

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...