Closed mdepedrof closed 1 week ago
Hi!!
I using this provider with pfsnese api. This ApiRest, when you are updating any resource, needs the id on the payload.
for now, I have this in terraform:
resource "restful_resource" "vpn_phase1" { for_each = local.deploy_vpns_phase1 ? toset(local.vpn_names) : [] write_only_attrs = [ "rekey_time", "nat_traversal", "ikeport", "peerid_type", "mode", "splitconn", "descr", "nattport", "myid_data", "iketype", "encryption", "pre_shared_key", "rand_time", "authentication_method", "gw_duplicates", "remote_gateway", "prfselect_enable", "certref", "dpd_maxfail", "myid_type", "interface", "dpd_delay", "mobike", "startaction", "caref", "peerid_data", "protocol", "reauth_time", "closeaction", "lifetime", "disabled" ] check_existance = false merge_patch_disabled = true path = "/api/v2/vpn/ipsec/phase1" create_method = "POST" body = merge(local.default_phase1_settings, { descr = "tf-${module.vpns.files[each.value].name}" peerid_data = module.vpns.files[each.value].right_id }) read_path = "$(path)s?ikeid=$(body.data.ikeid)" update_method = "PATCH" update_path = "$(path)" delete_path = "$(path)s?limit=1&ikeid=$(body.data.0.ikeid)" }
I think would be great if i can use a property like update_body so we can use like that:
update_body
resource "restful_resource" "vpn_phase1" { for_each = local.deploy_vpns_phase1 ? toset(local.vpn_names) : [] write_only_attrs = [ "rekey_time", "nat_traversal", "ikeport", "peerid_type", "mode", "splitconn", "descr", "nattport", "myid_data", "iketype", "encryption", "pre_shared_key", "rand_time", "authentication_method", "gw_duplicates", "remote_gateway", "prfselect_enable", "certref", "dpd_maxfail", "myid_type", "interface", "dpd_delay", "mobike", "startaction", "caref", "peerid_data", "protocol", "reauth_time", "closeaction", "lifetime", "disabled" ] check_existance = false merge_patch_disabled = true path = "/api/v2/vpn/ipsec/phase1" create_method = "POST" body = merge(local.default_phase1_settings, { descr = "tf-${module.vpns.files[each.value].name}" peerid_data = module.vpns.files[each.value].right_id }) read_path = "$(path)s?ikeid=$(body.data.ikeid)" update_method = "PATCH" delete_path = "$(path)s?limit=1&ikeid=$(body.data.0.ikeid)" update_path = "$(path)" update_body = merge(local.default_phase1_settings, { id = "$(body.data.id)" descr = "tf-${module.vpns.files[each.value].name}" peerid_data = module.vpns.files[each.value].right_id }) }
@mdepedrof Could you please try the main branch? If that works, I'll make a new release.
main
Hi!!
I using this provider with pfsnese api. This ApiRest, when you are updating any resource, needs the id on the payload.
for now, I have this in terraform:
I think would be great if i can use a property like
update_body
so we can use like that: