@@ -18,11 +18,17 @@ func TestAccClientGrant(t *testing.T) {
1818 Config : testAccClientGrantConfigCreate ,
1919 Check : resource .ComposeTestCheckFunc (
2020 resource .TestCheckResourceAttr ("auth0_client_grant.my_client_grant" , "audience" , "https://api.example.com/client-grant-test" ),
21- resource .TestCheckResourceAttr ("auth0_client_grant.my_client_grant" , "scope.0 " , "create:foo " ),
21+ resource .TestCheckResourceAttr ("auth0_client_grant.my_client_grant" , "scope.# " , "0 " ),
2222 ),
2323 },
2424 {
2525 Config : testAccClientGrantConfigUpdate ,
26+ Check : resource .ComposeTestCheckFunc (
27+ resource .TestCheckResourceAttr ("auth0_client_grant.my_client_grant" , "scope.0" , "create:foo" ),
28+ ),
29+ },
30+ {
31+ Config : testAccClientGrantConfigUpdateAgain ,
2632 Check : resource .ComposeTestCheckFunc (
2733 resource .TestCheckResourceAttr ("auth0_client_grant.my_client_grant" , "scope.#" , "0" ),
2834 ),
@@ -56,7 +62,7 @@ resource "auth0_resource_server" "my_resource_server" {
5662resource "auth0_client_grant" "my_client_grant" {
5763 client_id = "${auth0_client.my_client.id}"
5864 audience = "${auth0_resource_server.my_resource_server.identifier}"
59- scope = [ "create:foo" ]
65+ scope = [ ]
6066}
6167`
6268
@@ -85,6 +91,35 @@ resource "auth0_resource_server" "my_resource_server" {
8591resource "auth0_client_grant" "my_client_grant" {
8692 client_id = "${auth0_client.my_client.id}"
8793 audience = "${auth0_resource_server.my_resource_server.identifier}"
88- scope = [ ] # empty scope
94+ scope = [ "create:foo" ]
95+ }
96+ `
97+
98+ const testAccClientGrantConfigUpdateAgain = `
99+ provider "auth0" {}
100+
101+ resource "auth0_client" "my_client" {
102+ name = "Application - Client Grant - Acceptance Test"
103+ custom_login_page_on = true
104+ is_first_party = true
105+ }
106+
107+ resource "auth0_resource_server" "my_resource_server" {
108+ name = "Resource Server - Client Grant - Acceptance Test"
109+ identifier = "https://api.example.com/client-grant-test"
110+ scopes {
111+ value = "create:foo"
112+ description = "Create foos"
113+ }
114+ scopes {
115+ value = "create:bar"
116+ description = "Create bars"
117+ }
118+ }
119+
120+ resource "auth0_client_grant" "my_client_grant" {
121+ client_id = "${auth0_client.my_client.id}"
122+ audience = "${auth0_resource_server.my_resource_server.identifier}"
123+ scope = [ ]
89124}
90125`
0 commit comments