diff --git a/main.tf b/main.tf index feef3f7..3968c92 100644 --- a/main.tf +++ b/main.tf @@ -23,6 +23,14 @@ variable asset_type_security { default = "2" } +module "accounts" { + source = "modules/accounts" + general_account_role = "${module.account_roles.general_account_role}" + + rec_payments_signer_role = "${module.signer_roles.rec_payments_signer_role}" + default_signer_role = "${module.signer_roles.default_signer_role}" +} + // creates basic account rules module "account_rules" { source = "modules/account_rules" @@ -254,6 +262,11 @@ module "signer_roles" { create_kyc = [ "${module.signer_rules.kyc_recovery_creator}", ] + + rec_payments_rules = [ + "${module.signer_rules.tx_sender}", + "${module.signer_rules.rec_payment_creator}" + ] } module "key_values" { @@ -276,4 +289,5 @@ module "external_system_type_pool_entry" { module "signers" { source = "modules/signers" license_signer_role = "${module.signer_roles.license_signer_role}" + rec_payments_signer_role = "${module.signer_roles.rec_payments_signer_role}" } diff --git a/modules/account_roles/main.tf b/modules/account_roles/main.tf index e928df7..18a9dde 100644 --- a/modules/account_roles/main.tf +++ b/modules/account_roles/main.tf @@ -81,3 +81,7 @@ resource tokend_key_value "us_accredited" { value_type = "uint32" value = "${tokend_account_role.us_accredited.id}" } + +output "general_account_role" { + value = "${tokend_account_role.general.id}" +} \ No newline at end of file diff --git a/modules/accounts/main.tf b/modules/accounts/main.tf new file mode 100644 index 0000000..d31fab3 --- /dev/null +++ b/modules/accounts/main.tf @@ -0,0 +1,30 @@ +variable "general_account_role" { + type = "string" +} + +variable "rec_payments_signer_role" { + type = "string" +} + +variable "default_signer_role" { + type = "string" +} + +resource tokend_account "recurring_payments_account" { + account_id = "GBSO4E7YBNWOGQAW64RC4LACM3YNBH2C4PWRLNXILVFHG2AWANH54L5T" # SC45C2RCEBVIUMKU6MJBVDI2PULM4RXJBNGRZRSGRZRVIK5UZMFUFOIX + role_id = "${var.general_account_role}" + signers = [ + { + role_id = "${var.rec_payments_signer_role}" + public_key = "GDX6P3OBSMLKVPADU2FPJZJSSB6S5SCSMHKDC2RLJVE6PAWPDBGUM4QG" # SBZY7CTSALS4TJ5MZ47RPUNT7RLKY6ACN3F7U2KHRTFGMEXI43F5D2B6 + weight = 1000 + identity = 1 + }, + { + role_id = "${var.default_signer_role}" + public_key = "GDMIOBLB6F3R2NMWTA5ZPM7DHKOQ5EQWMI4KLSUOKDZQYXTU2PP4VUN5" # SB7KM4EMFJIQZYE2H66OVP6XPXDPEA2S2Y7DPCOV7OAJJKNW2UQVEYZJ + weight = 1000 + identity = 1 + } + ] +} \ No newline at end of file diff --git a/modules/signer_roles/main.tf b/modules/signer_roles/main.tf index b1a6ee8..534384f 100644 --- a/modules/signer_roles/main.tf +++ b/modules/signer_roles/main.tf @@ -10,6 +10,10 @@ variable "license_admin" { type = "list" } +variable "rec_payments_rules" { + type = "list" +} + variable "create_kyc" { type = "list" } @@ -66,7 +70,7 @@ resource tokend_signer_role "kyc_aml_admin" { resource tokend_signer_role "license_admin" { rules = [ - "${var.license_admin}" + "${var.license_admin}" ] details = { admin_role = true @@ -75,6 +79,17 @@ resource tokend_signer_role "license_admin" { } } +resource tokend_signer_role "rec_payments_signer" { + rules = [ + "${var.rec_payments_rules}" + ] + + details = { + admin_role = false + name = "Recurring Payments signer role" + description = "Able to sign recurring payments" + } +} // users operational signer role resource tokend_signer_role "default" { @@ -106,6 +121,20 @@ resource tokend_key_value "license_admin_role" { value = "${tokend_signer_role.license_admin.id}" } +resource tokend_key_value "rec_payments_role" { + key = "signer_role:rec_payments" + value_type = "uint64" + value = "${tokend_signer_role.rec_payments_signer.id}" +} + output "license_signer_role" { value = "${tokend_signer_role.license_admin.id}" } + +output "rec_payments_signer_role" { + value = "${tokend_signer_role.rec_payments_signer.id}" +} + +output "default_signer_role" { + value = "${tokend_signer_role.default.id}" +} \ No newline at end of file diff --git a/modules/signer_rules/main.tf b/modules/signer_rules/main.tf index 98fa207..75e1282 100644 --- a/modules/signer_rules/main.tf +++ b/modules/signer_rules/main.tf @@ -79,6 +79,15 @@ resource tokend_signer_rule "stamp_creator" { entry_type = "stamp" } +resource tokend_signer_rule "rec_payment_creator" { + action = "send" + entry_type = "asset" + entry = { + asset_code = "*" + asset_type = "*" + } +} + output "aml_alert_reviewer" { value = "${tokend_signer_rule.aml_alert_reviewer.id}" } @@ -119,6 +128,10 @@ output "license_creator" { value = "${tokend_signer_rule.license_creator.id}" } +output "rec_payment_creator" { + value = "${tokend_signer_rule.rec_payment_creator.id}" +} + output "stamp_creator" { value = "${tokend_signer_rule.stamp_creator.id}" } diff --git a/modules/signers/main.tf b/modules/signers/main.tf index a124bfe..a16337b 100644 --- a/modules/signers/main.tf +++ b/modules/signers/main.tf @@ -2,9 +2,13 @@ variable "license_signer_role" { type = "string" } +variable "rec_payments_signer_role" { + type = "string" +} + resource tokend_account_signer "license_signer" { public_key = "GAEOJ3TZ2HI2FNFLMS7KLYZXRX5YZKC5UBMXUH2B5O2KSJ7ALZQALHH3" weight = 1000 identity = 0 role_id = "${var.license_signer_role}" -} \ No newline at end of file +}