1. Packages
  2. Auth0
  3. API Docs
  4. ResourceServerScopes
Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi

auth0.ResourceServerScopes

Explore with Pulumi AI

auth0 logo
Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi

    With this resource, you can manage scopes (permissions) associated with a resource server (API).

    !> This resource manages all the scopes assigned to a resource server. In contrast, the auth0.ResourceServerScope resource only appends a scope to a resource server. To avoid potential issues, it is recommended not to use this resource in conjunction with the auth0.ResourceServerScope resource when managing scopes for the same resource server id.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    const myApi = new auth0.ResourceServer("my_api", {
        name: "Example Resource Server (Managed by Terraform)",
        identifier: "https://api.example.com",
    });
    const myApiScopes = new auth0.ResourceServerScopes("my_api_scopes", {
        resourceServerIdentifier: myApi.identifier,
        scopes: [
            {
                name: "create:appointments",
                description: "Ability to create appointments",
            },
            {
                name: "read:appointments",
                description: "Ability to read appointments",
            },
        ],
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    my_api = auth0.ResourceServer("my_api",
        name="Example Resource Server (Managed by Terraform)",
        identifier="https://api.example.com")
    my_api_scopes = auth0.ResourceServerScopes("my_api_scopes",
        resource_server_identifier=my_api.identifier,
        scopes=[
            auth0.ResourceServerScopesScopeArgs(
                name="create:appointments",
                description="Ability to create appointments",
            ),
            auth0.ResourceServerScopesScopeArgs(
                name="read:appointments",
                description="Ability to read appointments",
            ),
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		myApi, err := auth0.NewResourceServer(ctx, "my_api", &auth0.ResourceServerArgs{
    			Name:       pulumi.String("Example Resource Server (Managed by Terraform)"),
    			Identifier: pulumi.String("https://api.example.com"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewResourceServerScopes(ctx, "my_api_scopes", &auth0.ResourceServerScopesArgs{
    			ResourceServerIdentifier: myApi.Identifier,
    			Scopes: auth0.ResourceServerScopesScopeArray{
    				&auth0.ResourceServerScopesScopeArgs{
    					Name:        pulumi.String("create:appointments"),
    					Description: pulumi.String("Ability to create appointments"),
    				},
    				&auth0.ResourceServerScopesScopeArgs{
    					Name:        pulumi.String("read:appointments"),
    					Description: pulumi.String("Ability to read appointments"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Auth0 = Pulumi.Auth0;
    
    return await Deployment.RunAsync(() => 
    {
        var myApi = new Auth0.ResourceServer("my_api", new()
        {
            Name = "Example Resource Server (Managed by Terraform)",
            Identifier = "https://api.example.com",
        });
    
        var myApiScopes = new Auth0.ResourceServerScopes("my_api_scopes", new()
        {
            ResourceServerIdentifier = myApi.Identifier,
            Scopes = new[]
            {
                new Auth0.Inputs.ResourceServerScopesScopeArgs
                {
                    Name = "create:appointments",
                    Description = "Ability to create appointments",
                },
                new Auth0.Inputs.ResourceServerScopesScopeArgs
                {
                    Name = "read:appointments",
                    Description = "Ability to read appointments",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.auth0.ResourceServer;
    import com.pulumi.auth0.ResourceServerArgs;
    import com.pulumi.auth0.ResourceServerScopes;
    import com.pulumi.auth0.ResourceServerScopesArgs;
    import com.pulumi.auth0.inputs.ResourceServerScopesScopeArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var myApi = new ResourceServer("myApi", ResourceServerArgs.builder()
                .name("Example Resource Server (Managed by Terraform)")
                .identifier("https://api.example.com")
                .build());
    
            var myApiScopes = new ResourceServerScopes("myApiScopes", ResourceServerScopesArgs.builder()
                .resourceServerIdentifier(myApi.identifier())
                .scopes(            
                    ResourceServerScopesScopeArgs.builder()
                        .name("create:appointments")
                        .description("Ability to create appointments")
                        .build(),
                    ResourceServerScopesScopeArgs.builder()
                        .name("read:appointments")
                        .description("Ability to read appointments")
                        .build())
                .build());
    
        }
    }
    
    resources:
      myApi:
        type: auth0:ResourceServer
        name: my_api
        properties:
          name: Example Resource Server (Managed by Terraform)
          identifier: https://api.example.com
      myApiScopes:
        type: auth0:ResourceServerScopes
        name: my_api_scopes
        properties:
          resourceServerIdentifier: ${myApi.identifier}
          scopes:
            - name: create:appointments
              description: Ability to create appointments
            - name: read:appointments
              description: Ability to read appointments
    

    Create ResourceServerScopes Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ResourceServerScopes(name: string, args: ResourceServerScopesArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceServerScopes(resource_name: str,
                             args: ResourceServerScopesArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceServerScopes(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             resource_server_identifier: Optional[str] = None,
                             scopes: Optional[Sequence[ResourceServerScopesScopeArgs]] = None)
    func NewResourceServerScopes(ctx *Context, name string, args ResourceServerScopesArgs, opts ...ResourceOption) (*ResourceServerScopes, error)
    public ResourceServerScopes(string name, ResourceServerScopesArgs args, CustomResourceOptions? opts = null)
    public ResourceServerScopes(String name, ResourceServerScopesArgs args)
    public ResourceServerScopes(String name, ResourceServerScopesArgs args, CustomResourceOptions options)
    
    type: auth0:ResourceServerScopes
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ResourceServerScopesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ResourceServerScopesArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ResourceServerScopesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceServerScopesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceServerScopesArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var resourceServerScopesResource = new Auth0.ResourceServerScopes("resourceServerScopesResource", new()
    {
        ResourceServerIdentifier = "string",
        Scopes = new[]
        {
            new Auth0.Inputs.ResourceServerScopesScopeArgs
            {
                Name = "string",
                Description = "string",
            },
        },
    });
    
    example, err := auth0.NewResourceServerScopes(ctx, "resourceServerScopesResource", &auth0.ResourceServerScopesArgs{
    	ResourceServerIdentifier: pulumi.String("string"),
    	Scopes: auth0.ResourceServerScopesScopeArray{
    		&auth0.ResourceServerScopesScopeArgs{
    			Name:        pulumi.String("string"),
    			Description: pulumi.String("string"),
    		},
    	},
    })
    
    var resourceServerScopesResource = new ResourceServerScopes("resourceServerScopesResource", ResourceServerScopesArgs.builder()
        .resourceServerIdentifier("string")
        .scopes(ResourceServerScopesScopeArgs.builder()
            .name("string")
            .description("string")
            .build())
        .build());
    
    resource_server_scopes_resource = auth0.ResourceServerScopes("resourceServerScopesResource",
        resource_server_identifier="string",
        scopes=[auth0.ResourceServerScopesScopeArgs(
            name="string",
            description="string",
        )])
    
    const resourceServerScopesResource = new auth0.ResourceServerScopes("resourceServerScopesResource", {
        resourceServerIdentifier: "string",
        scopes: [{
            name: "string",
            description: "string",
        }],
    });
    
    type: auth0:ResourceServerScopes
    properties:
        resourceServerIdentifier: string
        scopes:
            - description: string
              name: string
    

    ResourceServerScopes Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ResourceServerScopes resource accepts the following input properties:

    ResourceServerIdentifier string
    Identifier of the resource server that the scopes (permission) are associated with.
    Scopes List<ResourceServerScopesScope>
    ResourceServerIdentifier string
    Identifier of the resource server that the scopes (permission) are associated with.
    Scopes []ResourceServerScopesScopeArgs
    resourceServerIdentifier String
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes List<ResourceServerScopesScope>
    resourceServerIdentifier string
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes ResourceServerScopesScope[]
    resource_server_identifier str
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes Sequence[ResourceServerScopesScopeArgs]
    resourceServerIdentifier String
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes List<Property Map>

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ResourceServerScopes resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ResourceServerScopes Resource

    Get an existing ResourceServerScopes resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ResourceServerScopesState, opts?: CustomResourceOptions): ResourceServerScopes
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            resource_server_identifier: Optional[str] = None,
            scopes: Optional[Sequence[ResourceServerScopesScopeArgs]] = None) -> ResourceServerScopes
    func GetResourceServerScopes(ctx *Context, name string, id IDInput, state *ResourceServerScopesState, opts ...ResourceOption) (*ResourceServerScopes, error)
    public static ResourceServerScopes Get(string name, Input<string> id, ResourceServerScopesState? state, CustomResourceOptions? opts = null)
    public static ResourceServerScopes get(String name, Output<String> id, ResourceServerScopesState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ResourceServerIdentifier string
    Identifier of the resource server that the scopes (permission) are associated with.
    Scopes List<ResourceServerScopesScope>
    ResourceServerIdentifier string
    Identifier of the resource server that the scopes (permission) are associated with.
    Scopes []ResourceServerScopesScopeArgs
    resourceServerIdentifier String
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes List<ResourceServerScopesScope>
    resourceServerIdentifier string
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes ResourceServerScopesScope[]
    resource_server_identifier str
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes Sequence[ResourceServerScopesScopeArgs]
    resourceServerIdentifier String
    Identifier of the resource server that the scopes (permission) are associated with.
    scopes List<Property Map>

    Supporting Types

    ResourceServerScopesScope, ResourceServerScopesScopeArgs

    Name string
    Name of the scope (permission). Examples include read:appointments or delete:appointments.
    Description string
    User-friendly description of the scope (permission).
    Name string
    Name of the scope (permission). Examples include read:appointments or delete:appointments.
    Description string
    User-friendly description of the scope (permission).
    name String
    Name of the scope (permission). Examples include read:appointments or delete:appointments.
    description String
    User-friendly description of the scope (permission).
    name string
    Name of the scope (permission). Examples include read:appointments or delete:appointments.
    description string
    User-friendly description of the scope (permission).
    name str
    Name of the scope (permission). Examples include read:appointments or delete:appointments.
    description str
    User-friendly description of the scope (permission).
    name String
    Name of the scope (permission). Examples include read:appointments or delete:appointments.
    description String
    User-friendly description of the scope (permission).

    Import

    This resource can be imported by specifying the resource server identifier.

    Example:

    $ pulumi import auth0:index/resourceServerScopes:ResourceServerScopes my_api_scopes "https://api.travel0.com/v1"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Auth0 pulumi/pulumi-auth0
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the auth0 Terraform Provider.
    auth0 logo
    Auth0 v3.4.0 published on Wednesday, Jun 19, 2024 by Pulumi