Skip to content

Commit 990d50f

Browse files
committed
site metrics settings
1 parent 83ea8f9 commit 990d50f

File tree

14 files changed

+558
-25
lines changed

14 files changed

+558
-25
lines changed

UPDATING_OPENAPI_JSON.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ This project uses a modified `openapi.json`. Please maintain these instructions
2929
1. Replace the response body of the `getAccountFirewallRuleSet` operation to use the `SiteFirewallConfig` object.
3030
1. Replace the request body of the `updateAccountFirewallRuleSet` operation to use the `SiteFirewallConfig` object.
3131
1. Renamed the `unpublished_rules` and `published_rules` properties to `unpublished` and `published` in the `SiteFirewallConfig` object, also in the required properties array.
32+
1. Add a `rum_enabled` property of type `boolean` to the `Site` object.
33+
1. Add a `rum_enabled` property of type `boolean` to the `PartialSite` object.
34+
1. Add an `analytics_instance_id` property of type `string` to the `Site` object.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "netlify_site_metrics_settings Resource - netlify"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# netlify_site_metrics_settings (Resource)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "netlify_site_metrics_settings" "blog" {
17+
site_id = data.netlify_site.blog.id
18+
site_analytics = true
19+
real_user_metrics = true
20+
}
21+
```
22+
23+
<!-- schema generated by tfplugindocs -->
24+
## Schema
25+
26+
### Required
27+
28+
- `site_id` (String)
29+
30+
### Optional
31+
32+
- `real_user_metrics` (Boolean) Enable real user metrics. Warning: This might incur a cost on certain plans.
33+
- `site_analytics` (Boolean) Enable site analytics. Warning: This might incur a cost on certain plans. Note: You must wait 10 minutes before disabling after enabling.
34+
35+
### Read-Only
36+
37+
- `last_updated` (String)
38+
39+
## Import
40+
41+
Import is supported using the following syntax:
42+
43+
```shell
44+
# Import a site's metrics settings by the site ID
45+
terraform import netlify_site_metrics_settings.blog 12345667-0000-0000-0000-abcdef012345
46+
```

examples/misc/site_settings/main.tf

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,36 @@ terraform {
1010
# `token` comes from NETLIFY_API_TOKEN, but can be specified with a Terraform variable
1111
provider "netlify" {}
1212

13-
data "netlify_site" "platform_test" {
14-
team_slug = "ramon-test-1"
15-
name = "platform-test-1"
16-
}
13+
# data "netlify_site" "platform_test" {
14+
# team_slug = "ramon-test-1"
15+
# name = "platform-test-1"
16+
# }
1717

18-
resource "netlify_site_build_settings" "platform_test" {
19-
site_id = data.netlify_site.platform_test.id
20-
build_command = "npm run build"
21-
publish_directory = "dist"
22-
production_branch = "main"
23-
branch_deploy_branches = ["meow", "woof"]
24-
}
18+
# resource "netlify_site_build_settings" "platform_test" {
19+
# site_id = data.netlify_site.platform_test.id
20+
# build_command = "npm run build"
21+
# publish_directory = "dist"
22+
# production_branch = "main"
23+
# branch_deploy_branches = ["meow", "woof"]
24+
# }
2525

26-
resource "netlify_site_domain_settings" "platform_test" {
27-
site_id = data.netlify_site.platform_test.id
28-
custom_domain = "platform-test.example-tf-test-test.com"
29-
domain_aliases = ["meow.example-tf-test-test.com"]
30-
branch_deploy_custom_domain = "branch.example-tf-test-test.com"
31-
deploy_preview_custom_domain = "dp.example-tf-test-test.com"
32-
}
26+
# resource "netlify_site_domain_settings" "platform_test" {
27+
# site_id = data.netlify_site.platform_test.id
28+
# custom_domain = "platform-test.example-tf-test-test.com"
29+
# domain_aliases = ["meow.example-tf-test-test.com"]
30+
# branch_deploy_custom_domain = "branch.example-tf-test-test.com"
31+
# deploy_preview_custom_domain = "dp.example-tf-test-test.com"
32+
# }
33+
34+
# resource "netlify_site_collaboration_settings" "platform_test" {
35+
# site_id = data.netlify_site.platform_test.id
36+
# netlify_drawer_in_deploy_previews = true
37+
# netlify_drawer_in_branch_deploys = true
38+
# netlify_heads_up_display = true
39+
# }
3340

34-
resource "netlify_site_collaboration_settings" "platform_test" {
35-
site_id = data.netlify_site.platform_test.id
36-
netlify_drawer_in_deploy_previews = true
37-
netlify_drawer_in_branch_deploys = true
38-
netlify_heads_up_display = true
41+
resource "netlify_site_metrics_settings" "example" {
42+
site_id = "5b407d6d-9385-4e7a-a4c4-8efc11ea3c26"
43+
site_analytics = false
44+
real_user_metrics = false
3945
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Import a site's metrics settings by the site ID
2+
terraform import netlify_site_metrics_settings.blog 12345667-0000-0000-0000-abcdef012345
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "netlify_site_metrics_settings" "blog" {
2+
site_id = data.netlify_site.blog.id
3+
site_analytics = true
4+
real_user_metrics = true
5+
}

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSey
142142
github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA=
143143
github.com/hashicorp/terraform-plugin-framework v1.12.0 h1:7HKaueHPaikX5/7cbC1r9d1m12iYHY+FlNZEGxQ42CQ=
144144
github.com/hashicorp/terraform-plugin-framework v1.12.0/go.mod h1:N/IOQ2uYjW60Jp39Cp3mw7I/OpC/GfZ0385R0YibmkE=
145-
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E=
146-
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo=
147145
github.com/hashicorp/terraform-plugin-framework-validators v0.14.0 h1:3PCn9iyzdVOgHYOBmncpSSOxjQhCTYmc+PGvbdlqSaI=
148146
github.com/hashicorp/terraform-plugin-framework-validators v0.14.0/go.mod h1:LwDKNdzxrDY/mHBrlC6aYfE2fQ3Dk3gaJD64vNiXvo4=
149147
github.com/hashicorp/terraform-plugin-go v0.24.0 h1:2WpHhginCdVhFIrWHxDEg6RBn3YaWzR2o6qUeIEat2U=

internal/netlifyapi/api/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10693,6 +10693,7 @@ components:
1069310693
force_ssl: true
1069410694
notification_email: notification_email
1069510695
capabilities: "{}"
10696+
rum_enabled: true
1069610697
hud_enabled: true
1069710698
admin_url: admin_url
1069810699
build_settings:
@@ -10738,6 +10739,7 @@ components:
1073810739
description: description
1073910740
id: id
1074010741
account_slug: account_slug
10742+
analytics_instance_id: analytics_instance_id
1074110743
account_id: account_id
1074210744
ssl_url: ssl_url
1074310745
name: name
@@ -10800,6 +10802,10 @@ components:
1080010802
type: string
1080110803
force_ssl:
1080210804
type: boolean
10805+
rum_enabled:
10806+
type: boolean
10807+
analytics_instance_id:
10808+
type: string
1080310809
build_settings:
1080410810
$ref: '#/components/schemas/Repo'
1080510811
processing_settings:
@@ -10904,6 +10910,7 @@ components:
1090410910
force_ssl: true
1090510911
notification_email: notification_email
1090610912
capabilities: "{}"
10913+
rum_enabled: true
1090710914
hud_enabled: true
1090810915
admin_url: admin_url
1090910916
build_settings:
@@ -11011,6 +11018,8 @@ components:
1101111018
type: string
1101211019
force_ssl:
1101311020
type: boolean
11021+
rum_enabled:
11022+
type: boolean
1101411023
build_settings:
1101511024
$ref: '#/components/schemas/Repo'
1101611025
processing_settings:

internal/netlifyapi/model_admin_site.go

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/netlifyapi/model_partial_site.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)