When using the data object for "checkpoint_management_show_updatable_objects_repository_content" it returns an accurate state as long as you haven't already defined it as a resource: resource "checkpoint_management_add_updatable_object"
Example:
Before adding it in the local repository: (notice updatable object is empty, meaning its not added)
{
"module": "module.global",
"mode": "data",
"type": "checkpoint_management_show_updatable_objects_repository_content",
"name": "updateable_objects_amazon_us_east_1_services",
"provider": "provider[\"registry.terraform.io/checkpointsw/checkpoint\"].main",
"instances": [
{
"schema_version": 0,
"attributes": {
"filter": {
"text": "Amazon US East 1 Services"
},
"from": 1,
"id": "show-updatable-objects-repository-content-4muvr3p772",
"limit": null,
"objects": [
{
"additional_properties": {
"description": "This is an Amazon object, derived from a link listed below, and all its content is subject to Amazon IPs. Amazon Web Services (abbreviated AWS) is a collection of remote computing services (also called web services) that together make up a cloud computing platform, offered over the Internet by Amazon.com.",
"info_text": "Amazon Web Services IP address ranges info page",
"info_url": "http://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html",
"uri": "/Updatable Objects/Amazon Web Services/Amazon Services"
},
"name_in_updatable_objects_repository": "Amazon US East 1 Services",
"uid_in_updatable_objects_repository": "aee83a51-72c8-11e7-9ce2-54a52c295409",
"updatable_object": {}
}
],
"offset": null,
"order": null,
"to": 1,
"total": 1,
"uid_in_updatable_objects_repository": null
},
"sensitive_attributes": []
}
]
},
After adding the object via the "checkpoint_management_add_updatable_object":
Step 2 - Pull the updatable object you want using the text filter: (this will work as long as you haven't already added it to your management repository)
# Terraform provider bug - data source doesn't return objects after you use "checkpoint_management_add_updatable_object" resource
data "checkpoint_management_show_updatable_objects_repository_content" "search_updatable_objects_amazon_us_east_1_services" {
depends_on = [checkpoint_management_update_updatable_objects_repository_content.updatable_objects_update]
filter = {
text = "Amazon US East 1 Services"
}
}
Step 3 - Use the remote repository uid you found in step 2 to add it to your management for use
Note: We have to "ignore" any changes to the uid, because on subsequent terraform runs, when Step 2 runs it will return an emtpy object without a UID.
# Terraform provider bug - data source doesn't return objects after you use "checkpoint_management_add_updatable_object" resource
resource "checkpoint_management_add_updatable_object" "uo_aws_us_east_1_services" {
depends_on = [data.checkpoint_management_show_updatable_objects_repository_content.search_updatable_objects_amazon_us_east_1_services]
uid_in_updatable_objects_repository = data.checkpoint_management_show_updatable_objects_repository_content.search_updatable_objects_amazon_us_east_1_services.objects[0].uid_in_updatable_objects_repository
lifecycle {
ignore_changes = [uid_in_updatable_objects_repository]
}
}
Step 4 - Create a manual dependency on the object being added so you can use it in a rule:
When using the data object for "checkpoint_management_show_updatable_objects_repository_content" it returns an accurate state as long as you haven't already defined it as a resource: resource "checkpoint_management_add_updatable_object"
Example: Before adding it in the local repository: (notice updatable object is empty, meaning its not added)
After adding the object via the "checkpoint_management_add_updatable_object":
I believe this might be because the schema for the "updatable object {}" object is inaccurate.
In case anyone is here looking for a work around, I was able to do it this way:
Step 1 - Always update the Remote Repository
Step 2 - Pull the updatable object you want using the text filter: (this will work as long as you haven't already added it to your management repository)
Step 3 - Use the remote repository uid you found in step 2 to add it to your management for use Note: We have to "ignore" any changes to the uid, because on subsequent terraform runs, when Step 2 runs it will return an emtpy object without a UID.
Step 4 - Create a manual dependency on the object being added so you can use it in a rule: