Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add extra variables #9

Merged
merged 8 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .idea/misc.xml

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

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ This module creates infra to support exporting data from Worklytics to AWS.

It is published in the [Terraform Registry](https://registry.terraform.io/modules/Worklytics/worklytics-export/aws/latest).

If it does not meet your needs, feel free to directly copy the `main.tf` file into your own Terraform
configuration and adapt it to your requirements.

## Usage

from Terraform registry:
```hcl
module "worklytics-export" {
source = "terraform-aws-worklytics-export"
version = "~> 0.3.0"
version = "~> 0.4.0"

# numeric ID of your Worklytics Tenant SA
worklytics_tenant_id = "123123123123"
Expand All @@ -23,7 +26,7 @@ module "worklytics-export" {
via GitHub:
```hcl
module "worklytics-export" {
source = "git::https://github.com/worklytics/terraform-aws-worklytics-export/?ref=v0.3.0"
source = "git::https://github.com/worklytics/terraform-aws-worklytics-export/?ref=v0.4.0"

# numeric ID of your Worklytics Tenant SA
worklytics_tenant_id = "123123123123"
Expand Down
5 changes: 4 additions & 1 deletion examples/basic-remote/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ terraform {

module "worklytics_export" {
source = "terraform-aws-worklytics-export"
version = "~> 0.3.0"
version = "~> 0.4.0"

resource_name_prefix = var.resource_name_prefix
worklytics_tenant_id = var.worklytics_tenant_id
worklytics_host = var.worklytics_host
todos_as_outputs = var.todos_as_outputs
todos_as_local_files = var.todos_as_local_files
}

output "worklytics_export_bucket_id" {
Expand Down
17 changes: 12 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,22 @@ locals {
todo_content = <<EOT
# Configure Data Export in Worklytics

1. Ensure you're authenticated with Worklytics. Either sign-in at [https://app.worklytics.co](https://app.worklytics.co)
with your organization's SSO provider *or* request OTP link from your Worklytics support team.
2. Visit `https://app.worklytics.co/analytics/data-export/connect?bucket=${aws_s3_bucket
1. Ensure you're authenticated with Worklytics. Either sign-in at [https://${var.worklytics_host}](https://${var.worklytics_host})
with your organization's SSO provider *or* request OTP link from your Worklytics support.
2. Visit `https://${var.worklytics_host}/analytics/data-export/connect?bucket=${aws_s3_bucket
.worklytics_export.bucket}&roleArn=${aws_iam_role.for_worklytics_tenant.arn}`
3. Review any additional settings (such as the Dataset type you'd like to export) and adjust
values as you see fit, then click "Create Data Export".

Alternatively, you may follow the manual instructions below:

1. Visit [https://app.worklytics.co/analytics/data-export](https://app.worklytics.co/analytics/data-export)
1. Visit [https://${var.worklytics_host}/analytics/data-export](https://${var.worklytics_host}/analytics/data-export)
(or login into Worklytics, and navigate to Manage --> Export Data).
2. Click on the 'Create New Data Export' button in the upper right.
3. Fill in the form with the following values:
- **Data Export Name** - choose a name that will help you identify this export in the future.
- **Data Export Type** - choose the type of data you'd like to export. Check our
[Data Export Documentation](https://app.worklytics.co/docs/data-export) for a complete
[Data Export Documentation](https://${var.worklytics_host}/docs/data-export) for a complete
description of all the available datasets.
- **Data Destination** - choose 'Amazon S3', use `${aws_s3_bucket.worklytics_export.bucket}`
for the **Bucket** field, and `${aws_iam_role.for_worklytics_tenant.arn}` for the **Role ARN**
Expand All @@ -137,8 +137,15 @@ EOT
}

resource "local_file" "todo" {
count = var.todos_as_local_files ? 1 : 0

filename = "TODO - configure export in worklytics.md"

content = local.todo_content
}

# moved in 0.4.0
moved {
from = local_file.todo
to = local_file.todo[0]
}
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ output "worklytics_tenant_aws_role" {
}

output "todo_markdown" {
value = local.todo_content
value = var.todos_as_outputs ? local.todo_content : null
description = "Actions that must be performed outside of Terraform (markdown format)."
}
17 changes: 17 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,20 @@ variable "enable_aws_s3_bucket_public_access_block" {
default = true
}

variable "worklytics_host" {
type = string
description = "host of worklytics instance where tenant resides. (e.g. app.worklytics.co for prod; but may differ for dev/staging)"
default = "app.worklytics.co"
}

variable "todos_as_outputs" {
type = bool
description = "whether to render TODOs as outputs (former useful if you're using Terraform Cloud/Enterprise, or somewhere else where the filesystem is not readily accessible to you)"
default = false
}

variable "todos_as_local_files" {
type = bool
description = "whether to render TODOs as flat files"
default = true
}
Loading