resource.tf (1694B)
1 # Existing media 2 resource "matrix_content" "catpic" { 3 # Your MXC URI must fit the following format/example: 4 # Format: mxc://origin/media_id 5 # Example: mxc://matrix.org/SomeGeneratedId 6 origin = "matrix.org" 7 media_id = "SomeGeneratedId" 8 } 9 10 # New media (upload) 11 resource "matrix_content" "catpic" { 12 file_path = "/path/to/cat_pic.png" 13 file_name = "cat_pic.png" 14 file_type = "image/png" 15 } 16 17 # Username/password user 18 resource "matrix_user" "foouser" { 19 username = "foouser" 20 password = "hunter2" 21 22 # These properties are optional, and will update the user's profile 23 # We're using a reference to the Media used in an earlier example 24 display_name = "My Cool User" 25 avatar_mxc = matrix_content.catpic.id 26 } 27 28 29 # Access token user 30 resource "matrix_user" "baruser" { 31 access_token = "MDAxOtherCharactersHere" 32 33 # These properties are optional, and will update the user's profile 34 # We're using a reference to the Media used in an earlier example 35 display_name = "My Cool User" 36 avatar_mxc = matrix_content.catpic.id 37 } 38 39 # Already existing room 40 resource "matrix_room" "fooroom" { 41 room_id = "!somewhere:domain.com" 42 member_access_token = matrix_user.foouser.access_token 43 } 44 45 # New room 46 resource "matrix_room" "barroom" { 47 creator_user_id = matrix_user.foouser.id 48 member_access_token = matrix_user.foouser.access_token 49 50 # The rest is optional 51 name = "My Room" 52 avatar_mxc = matrix_content.catpic.id 53 topic = "For testing only please" 54 preset = "public_chat" 55 guests_allowed = true 56 invite_user_ids = ["${matrix_user.baruser.id}"] 57 local_alias_localpart = "myroom" 58 }