Prisma Cloud: How To Import Resources Using The Prisma Cloud Terraform Provider

Prisma Cloud: How To Import Resources Using The Prisma Cloud Terraform Provider

2973
Created On 07/31/23 05:30 AM - Last Modified 08/08/23 18:00 PM


Objective


Be able to import resources from Prisma Cloud into your Terraform state file and edit them.

Environment


  • Prisma Cloud 
  • Terraform
  • Visual Studio Code (Integration development environment)
  • API


Procedure


  1. Create an empty resource of your choice in your .tf file 
Screenshot 2023-07-30 at 9.59.54 PM.png
  1. Run the terraform import command with resource ID of the resource that you want to import.
terraform import prismacloud_policy.example 11111111-2222-3333-4444-5555555555
Note: A resource ID can be found from Prisma Cloud for any resource present there. In this example we're using a custom policy already present in Prisma Cloud with the policy ID 7708abaf-c7d5-49ed-b11d-e3665d2d3b77

Screenshot 2023-07-30 at 10.05.42 PM.png
  • This is what the resource looks like in the state file after being imported
Screenshot 2023-07-30 at 10.18.52 PM.png
  1. Modify the resource block from step 1
Screenshot 2023-07-30 at 10.20.25 PM.png
  1. Run the terraform apply command after changes to the resource block have been made
Screenshot 2023-07-30 at 10.20.59 PM.pngScreenshot 2023-07-30 at 10.21.08 PM.png


Additional Information


Terraform Documentation

Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u000000XfreCAC&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail

Choose Language