Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kapicic authored Dec 4, 2023
0 parents commit 0c24438
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/abbey-grant-kit-generate-policy-input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Abbey Grant Kit Generate Policy Input

on:
pull_request:
jobs:
output-plan:
runs-on: ubuntu-latest
env:
TF_VAR_abbey_token: ${{ secrets.ABBEY_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Terraform
id: setup
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- name: Terraform Init
id: init
run: terraform init
env:
TF_HTTP_USERNAME: quickstart-basic
TF_HTTP_PASSWORD: ${{ secrets.ABBEY_TOKEN }}

- name: Terraform Plan
id: plan
run: terraform plan -no-color -input=false -out=tfplan
env:
TF_HTTP_USERNAME: quickstart-basic
TF_HTTP_PASSWORD: ${{ secrets.ABBEY_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/abbey-grant-kit-materialize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Abbey Grant Kit Materialize

on:
push:
branches:
- main

jobs:
materialize:
runs-on: ubuntu-latest
env:
TF_VAR_abbey_token: ${{ secrets.ABBEY_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- name: Terraform Init
id: init
run: terraform init
env:
TF_HTTP_USERNAME: quickstart-basic
TF_HTTP_PASSWORD: ${{ secrets.ABBEY_TOKEN }}

- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false
env:
TF_HTTP_USERNAME: quickstart-basic
TF_HTTP_PASSWORD: ${{ secrets.ABBEY_TOKEN }}
TF_VAR_abbey_token: ${{ secrets.ABBEY_TOKEN }}
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Created by https://www.toptal.com/developers/gitignore/api/terraform
# Edit at https://www.toptal.com/developers/gitignore?templates=terraform

### Terraform ###
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

# End of https://www.toptal.com/developers/gitignore/api/terraform
25 changes: 25 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Abbey Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Abbey Starter Kit Quickstart Example

This Quickstart is an example for how to use Abbey Labs and set up a Grant Kit. By the end, you’ll be able to configure a Workflow for users to request and approve access to the [Abbey Demo Site](https://app.abbey.io/demo).

## Usage

Visit this [Starter Kit's docs](https://docs.abbey.io/getting-started/quickstart) for a short usage walkthrough.

## :books: Learn More

To learn more about Grant Kits and Grant Workflows, visit the following resources:

- [Abbey Labs Documentation](https://docs.abbey.io) - learn about automating access management with Abbey Labs.
54 changes: 54 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
terraform {
backend "http" {
address = "https://api.abbey.io/terraform-http-backend"
lock_address = "https://api.abbey.io/terraform-http-backend/lock"
unlock_address = "https://api.abbey.io/terraform-http-backend/unlock"
lock_method = "POST"
unlock_method = "POST"
}

required_providers {
abbey = {
source = "abbeylabs/abbey"
version = "0.2.6"
}
}
}

provider "abbey" {
# Configuration options
bearer_auth = var.abbey_token
}

resource "abbey_grant_kit" "abbey_demo_site" {
name = "Abbey_Demo_Site"
description = <<-EOT
Grants access to Abbey's Demo Page.
EOT

workflow = {
steps = [
{
reviewers = {
one_of = ["replace-me@example.com"] # CHANGEME
}
}
]
}

policies = [
{ bundle = "github://replace-me-with-organization/replace-me-with-repo/policies" } # CHANGEME
]

output = {
# Replace with your own path pointing to where you want your access changes to manifest.
# Path is an RFC 3986 URI, such as `github://{organization}/{repo}/path/to/file.tf`.
location = "github://replace-me-with-organization/replace-me-with-repo/access.tf" # CHANGEME
append = <<-EOT
resource "abbey_demo" "grant_read_write_access" {
permission = "read_write"
email = "{{ .data.system.abbey.identities.abbey.email }}"
}
EOT
}
}
Empty file added outputs.tf
Empty file.
1 change: 1 addition & 0 deletions policies/common/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"roots": ["common"]}
8 changes: 8 additions & 0 deletions policies/common/common.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package common

import data.abbey.functions

allow[msg] {
functions.expire_after("0m")
msg := "granting access for 0 minutes"
}
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "abbey_token" {
type = string
sensitive = true
description = "Abbey API Token"
}

0 comments on commit 0c24438

Please sign in to comment.