1. Packages
  2. Tailscale
  3. API Docs
  4. Acl
Tailscale v0.15.0 published on Saturday, Mar 2, 2024 by Pulumi

tailscale.Acl

Explore with Pulumi AI

tailscale logo
Tailscale v0.15.0 published on Saturday, Mar 2, 2024 by Pulumi

    The acl resource allows you to configure a Tailscale ACL. See https://tailscale.com/kb/1018/acls for more information. Note that this resource will completely overwrite existing ACL contents for a given tailnet.

    If tests are defined in the ACL (the top-level “tests” section), ACL validation will occur before creation and update operations are applied.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Tailscale = Pulumi.Tailscale;
    
    return await Deployment.RunAsync(() => 
    {
        var asJson = new Tailscale.Acl("asJson", new()
        {
            AclJson = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["acls"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["action"] = "accept",
                        ["users"] = new[]
                        {
                            "*",
                        },
                        ["ports"] = new[]
                        {
                            "*:*",
                        },
                    },
                },
            }),
        });
    
        var asHujson = new Tailscale.Acl("asHujson", new()
        {
            AclJson = @"  {
        // Comments in HuJSON policy are preserved when the policy is applied.
        ""acls"": [
          {
            // Allow all users access to all ports.
            action = ""accept"",
            users  = [""*""],
            ports  = [""*:*""],
          },
        ],
      }
    ",
        });
    
    });
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-tailscale/sdk/go/tailscale"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"acls": []map[string]interface{}{
    				map[string]interface{}{
    					"action": "accept",
    					"users": []string{
    						"*",
    					},
    					"ports": []string{
    						"*:*",
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = tailscale.NewAcl(ctx, "asJson", &tailscale.AclArgs{
    			Acl: pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tailscale.NewAcl(ctx, "asHujson", &tailscale.AclArgs{
    			Acl: pulumi.String(`  {
        // Comments in HuJSON policy are preserved when the policy is applied.
        "acls": [
          {
            // Allow all users access to all ports.
            action = "accept",
            users  = ["*"],
            ports  = ["*:*"],
          },
        ],
      }
    `),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tailscale.Acl;
    import com.pulumi.tailscale.AclArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 asJson = new Acl("asJson", AclArgs.builder()        
                .acl(serializeJson(
                    jsonObject(
                        jsonProperty("acls", jsonArray(jsonObject(
                            jsonProperty("action", "accept"),
                            jsonProperty("users", jsonArray("*")),
                            jsonProperty("ports", jsonArray("*:*"))
                        )))
                    )))
                .build());
    
            var asHujson = new Acl("asHujson", AclArgs.builder()        
                .acl("""
      {
        // Comments in HuJSON policy are preserved when the policy is applied.
        "acls": [
          {
            // Allow all users access to all ports.
            action = "accept",
            users  = ["*"],
            ports  = ["*:*"],
          },
        ],
      }
                """)
                .build());
    
        }
    }
    
    import pulumi
    import json
    import pulumi_tailscale as tailscale
    
    as_json = tailscale.Acl("asJson", acl=json.dumps({
        "acls": [{
            "action": "accept",
            "users": ["*"],
            "ports": ["*:*"],
        }],
    }))
    as_hujson = tailscale.Acl("asHujson", acl="""  {
        // Comments in HuJSON policy are preserved when the policy is applied.
        "acls": [
          {
            // Allow all users access to all ports.
            action = "accept",
            users  = ["*"],
            ports  = ["*:*"],
          },
        ],
      }
    """)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as tailscale from "@pulumi/tailscale";
    
    const asJson = new tailscale.Acl("asJson", {acl: JSON.stringify({
        acls: [{
            action: "accept",
            users: ["*"],
            ports: ["*:*"],
        }],
    })});
    const asHujson = new tailscale.Acl("asHujson", {acl: `  {
        // Comments in HuJSON policy are preserved when the policy is applied.
        "acls": [
          {
            // Allow all users access to all ports.
            action = "accept",
            users  = ["*"],
            ports  = ["*:*"],
          },
        ],
      }
    `});
    
    resources:
      asJson:
        type: tailscale:Acl
        properties:
          acl:
            fn::toJSON:
              acls:
                - action: accept
                  users:
                    - '*'
                  ports:
                    - '*:*'
      asHujson:
        type: tailscale:Acl
        properties:
          acl: |2
              {
                // Comments in HuJSON policy are preserved when the policy is applied.
                "acls": [
                  {
                    // Allow all users access to all ports.
                    action = "accept",
                    users  = ["*"],
                    ports  = ["*:*"],
                  },
                ],
              }
    

    Create Acl Resource

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

    Constructor syntax

    new Acl(name: string, args: AclArgs, opts?: CustomResourceOptions);
    @overload
    def Acl(resource_name: str,
            args: AclArgs,
            opts: Optional[ResourceOptions] = None)
    
    @overload
    def Acl(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            acl: Optional[str] = None,
            overwrite_existing_content: Optional[bool] = None)
    func NewAcl(ctx *Context, name string, args AclArgs, opts ...ResourceOption) (*Acl, error)
    public Acl(string name, AclArgs args, CustomResourceOptions? opts = null)
    public Acl(String name, AclArgs args)
    public Acl(String name, AclArgs args, CustomResourceOptions options)
    
    type: tailscale:Acl
    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 AclArgs
    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 AclArgs
    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 AclArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AclArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AclArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var aclResource = new Tailscale.Acl("aclResource", new()
    {
        AclJson = "string",
        OverwriteExistingContent = false,
    });
    
    example, err := tailscale.NewAcl(ctx, "aclResource", &tailscale.AclArgs{
    	Acl:                      pulumi.String("string"),
    	OverwriteExistingContent: pulumi.Bool(false),
    })
    
    var aclResource = new Acl("aclResource", AclArgs.builder()        
        .acl("string")
        .overwriteExistingContent(false)
        .build());
    
    acl_resource = tailscale.Acl("aclResource",
        acl="string",
        overwrite_existing_content=False)
    
    const aclResource = new tailscale.Acl("aclResource", {
        acl: "string",
        overwriteExistingContent: false,
    });
    
    type: tailscale:Acl
    properties:
        acl: string
        overwriteExistingContent: false
    

    Acl 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 Acl resource accepts the following input properties:

    AclJson string
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    OverwriteExistingContent bool
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    Acl string
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    OverwriteExistingContent bool
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl String
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwriteExistingContent Boolean
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl string
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwriteExistingContent boolean
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl str
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwrite_existing_content bool
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl String
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwriteExistingContent Boolean
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Acl 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 Acl Resource

    Get an existing Acl 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?: AclState, opts?: CustomResourceOptions): Acl
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            acl: Optional[str] = None,
            overwrite_existing_content: Optional[bool] = None) -> Acl
    func GetAcl(ctx *Context, name string, id IDInput, state *AclState, opts ...ResourceOption) (*Acl, error)
    public static Acl Get(string name, Input<string> id, AclState? state, CustomResourceOptions? opts = null)
    public static Acl get(String name, Output<String> id, AclState 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:
    AclJson string
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    OverwriteExistingContent bool
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    Acl string
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    OverwriteExistingContent bool
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl String
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwriteExistingContent Boolean
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl string
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwriteExistingContent boolean
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl str
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwrite_existing_content bool
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten
    acl String
    The policy that defines which devices and users are allowed to connect in your network. Can be either a JSON or a HuJSON string.
    overwriteExistingContent Boolean
    If true, will skip requirement to import acl before allowing changes. Be careful, can cause ACL to be overwritten

    Import

    ID doesn’t matter.

    $ pulumi import tailscale:index/acl:Acl sample_acl acl
    

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

    Package Details

    Repository
    tailscale pulumi/pulumi-tailscale
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the tailscale Terraform Provider.
    tailscale logo
    Tailscale v0.15.0 published on Saturday, Mar 2, 2024 by Pulumi