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

Enable telemetry #46

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docs/wiki/Deploy-SI-with-TF-Azure-CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Run the following commands to included the file in the fixtures.tfvars file wher

```bash
pubkey=$(cat .ssh/lza-oracle-single-instance.pub)
fixtures="ssh_key: \"$pubkey\""
fixtures="ssh_key = \"$pubkey\""
echo $fixtures > terraform/bootstrap/single_instance/fixtures.tfvars
```

Expand Down
16 changes: 8 additions & 8 deletions docs/wiki/Introduction-to-deploying-oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ The components are created as follows:

### Deploy through GitHub Actions

- [Single instance automated deployment with Terraform through GitHub Actions](./Deploy-SI-with-TF-GitHub-Actions) (recommended method)
- [Single instance automated deployment with Bicep through GitHub Actions](./Deploy-SI-with-Bicep-GitHub-Actions) (recommended method)
- [Dataguard automated deployment with Terraform through GitHub Actions](./Deploy-DG-with-TF-GitHub-Actions) (recommended method)
- [Dataguard automated deployment with Bicep through GitHub Actions](./Deploy-DG-with-Bicep-GitHub-Actions) (recommended method)
- [Single instance automated deployment with Terraform through GitHub Actions](./Deploy-SI-with-TF-GitHub-Actions.md) (recommended method)
- [Single instance automated deployment with Bicep through GitHub Actions](./Deploy-SI-with-Bicep-GitHub-Actions.md) (recommended method)
- [Dataguard automated deployment with Terraform through GitHub Actions](./Deploy-DG-with-TF-GitHub-Actions.md) (recommended method)
- [Dataguard automated deployment with Bicep through GitHub Actions](./Deploy-DG-with-Bicep-GitHub-Actions.md) (recommended method)

### Manual deployment

- [Single Instance manual deployment with Terraform through Azure CLI](./Deploy-SI-with-TF-Azure-CLI)
- [Single Instance manual deployment with Bicep through Azure CLI](./Deploy-SI-with-Bicep-Azure-CLI)
- [Dataguard manual deployment with Terraform through Azure CLI](./Deploy-DG-with-TF-Azure-CLI)
- [Dataguard manual deployment with Bicep through Azure CLI](./Deploy-DG-with-Bicep-Azure-CLI)
- [Single Instance manual deployment with Terraform through Azure CLI](./Deploy-SI-with-TF-Azure-CLI.md)
- [Single Instance manual deployment with Bicep through Azure CLI](./Deploy-SI-with-Bicep-Azure-CLI.md)
- [Dataguard manual deployment with Terraform through Azure CLI](./Deploy-DG-with-TF-Azure-CLI.md)
- [Dataguard manual deployment with Bicep through Azure CLI](./Deploy-DG-with-Bicep-Azure-CLI.md)
28 changes: 15 additions & 13 deletions docs/wiki/Telemetry.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
<!-- markdownlint-disable -->
## Telemetry Tracking Using Customer Usage Attribution (PID)
# Telemetry Tracking Using Customer Usage Attribution (PID)
<!-- markdownlint-restore -->

Microsoft can identify the deployments of the Azure Resource Manager and Bicep templates with the deployed Azure resources. Microsoft can correlate these resources used to support the deployments. Microsoft collects this information to provide the best experiences with their products and to operate their business. The telemetry is collected through [customer usage attribution](https://docs.microsoft.com/azure/marketplace/azure-partner-customer-usage-attribution). The data is collected and governed by Microsoft's privacy policies, located at the [trust center](https://www.microsoft.com/trustcenter).

To disable this tracking, we have included a parameter called `parTelemetryOptOut` to the following Terraform files in this repo with a simple boolean flag. The default value `false` which **does not** disable the telemetry. If you would like to disable this tracking, then simply set this value to `true` and this module will not be included in deployments and **therefore disables** the telemetry tracking.
## Terraform Module Telemetry Tracking

- ./terraform/bootstrap/data_guard/module.tf
- ./terraform/bootstrap/single_instance/module.tf
To disable this tracking, we have included a variable called `disable_telemetry` to the following Terraform files in this repo with a simple boolean flag. The default value `false` which **does not** disable the telemetry. If you would like to disable this tracking, then simply set this value to `true` and this module will not be included in deployments and **therefore disables** the telemetry tracking.

- ./terraform/bootstrap/data_guard/variables_global.tf
- ./terraform/bootstrap/single_instance/variables_global.tf

If you are happy with leaving telemetry tracking enabled, no changes are required.

In the module.tf file, you will see the following:
In the variables_global.tf file, you will see the following:

```terraform
fixme input from tf devs
variable "disable_telemetry" {
type = bool
description = "If set to true, will disable telemetry for the module. See https://aka.ms/alz-terraform-module-telemetry."
default = false
}
```

The default value is `false`, but by changing the parameter value `true` and saving this file, when you deploy this module regardless of the deployment method the module deployment below will be ignored and therefore telemetry will not be tracked.

```terraform
fixme input from tf devs
```
The default value is `false`, but by changing the parameter value to `true` and saving this file, when you deploy this module regardless of the deployment method telemetry will not be tracked.

## Module PID Value Mapping

The following are the unique ID's (also known as PIDs) used in each of the files:

| File Name | PID |
| ------------------------------- | ------------------------------------ |
| ./terraform/bootstrap/data_guard/module.tf | 5c1ac525-f51f-411b-a7ca-b82d06798166 |
| ./terraform/bootstrap/single_instance/module.tf | 725d2e48-c3bc-4564-8cf9-ba7b59c55bb4 |
| ./terraform/bootstrap/data_guard/variables_global.tf | 440d81eb-6657-4a7d-ad93-c7e9cc09e5da |
| ./terraform/bootstrap/single_instance/variables_global.tf | e43d2d9e-0482-48ed-a38e-aa3e63c52954 |
15 changes: 15 additions & 0 deletions terraform/bootstrap/data_guard/resources.telemetry.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The following random id is created once per module instantiation and is appended to the teleletry deployment name
resource "random_id" "telem" {
count = local.disable_telemetry ? 0 : 1
byte_length = 4
}

# This is the core module telemetry deployment that is only created if telemetry is enabled.
# It is deployed to the default subscription
resource "azurerm_subscription_template_deployment" "telemetry_core" {
count = local.telem_core_deployment_enabled ? 1 : 0
provider = azurerm
name = local.telem_core_arm_deployment_name
location = var.location
template_content = local.telem_arm_subscription_template_content
}
5 changes: 5 additions & 0 deletions terraform/bootstrap/data_guard/variables_global.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ variable "infrastructure" {
default = {}
}

variable "disable_telemetry" {
type = bool
description = "If set to true, will disable telemetry for the module. See https://aka.ms/alz-terraform-module-telemetry."
default = false
}
#########################################################################################
# Virtual Machine parameters #
#########################################################################################
Expand Down
42 changes: 42 additions & 0 deletions terraform/bootstrap/data_guard/variables_local.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
locals {
vnet_oracle_name = "vnet1"
database_subnet_name = "subnet1"
disable_telemetry = var.disable_telemetry
telem_core_puid = "440d81eb-6657-4a7d-ad93-c7e9cc09e5da"
empty_string = ""
telem_random_hex = can(random_id.telem[0].hex) ? random_id.telem[0].hex : local.empty_string
}


# This constructs the ARM deployment name that is used for the telemetry.
# We shouldn't ever hit the 64 character limit but use substr just in case
locals {
telem_core_arm_deployment_name = substr(
format(
"pid-%s_%s",
local.telem_core_puid,
local.telem_random_hex,
),
0,
64
)
}

locals {
telem_arm_subscription_template_content = <<TEMPLATE
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [],
"outputs": {
"telemetry": {
"type": "String",
"value": "For more information, see https://aka.ms/alz/tf/telemetry"
}
}
}
TEMPLATE
}

# Condition to determine whether we create the core telemetry deployment
locals {
telem_core_deployment_enabled = !local.disable_telemetry
}
15 changes: 15 additions & 0 deletions terraform/bootstrap/single_instance/resources.telemetry.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The following random id is created once per module instantiation and is appended to the teleletry deployment name
resource "random_id" "telem" {
count = local.disable_telemetry ? 0 : 1
byte_length = 4
}

# This is the core module telemetry deployment that is only created if telemetry is enabled.
# It is deployed to the default subscription
resource "azurerm_subscription_template_deployment" "telemetry_core" {
count = local.telem_core_deployment_enabled ? 1 : 0
provider = azurerm
name = local.telem_core_arm_deployment_name
location = var.location
template_content = local.telem_arm_subscription_template_content
}
6 changes: 6 additions & 0 deletions terraform/bootstrap/single_instance/variables_global.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ variable "infrastructure" {
default = {}
}

variable "disable_telemetry" {
type = bool
description = "If set to true, will disable telemetry for the module. See https://aka.ms/alz-terraform-module-telemetry."
default = false
}

#########################################################################################
# Virtual Machine parameters #
#########################################################################################
Expand Down
42 changes: 42 additions & 0 deletions terraform/bootstrap/single_instance/variables_local.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
locals {
vnet_oracle_name = "vnet1"
database_subnet_name = "subnet1"
disable_telemetry = var.disable_telemetry
telem_core_puid = "e43d2d9e-0482-48ed-a38e-aa3e63c52954"
empty_string = ""
telem_random_hex = can(random_id.telem[0].hex) ? random_id.telem[0].hex : local.empty_string
}


# This constructs the ARM deployment name that is used for the telemetry.
# We shouldn't ever hit the 64 character limit but use substr just in case
locals {
telem_core_arm_deployment_name = substr(
format(
"pid-%s_%s",
local.telem_core_puid,
local.telem_random_hex,
),
0,
64
)
}

locals {
telem_arm_subscription_template_content = <<TEMPLATE
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [],
"outputs": {
"telemetry": {
"type": "String",
"value": "For more information, see https://aka.ms/alz/tf/telemetry"
}
}
}
TEMPLATE
}

# Condition to determine whether we create the core telemetry deployment
locals {
telem_core_deployment_enabled = !local.disable_telemetry
}