@suss/terraform-gcp 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/index.cjs +30 -4
- package/dist/index.js +30 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Says what Google Cloud's Terraform provider declares, for `@suss/contract-terraf
|
|
|
4
4
|
|
|
5
5
|
## What this package is
|
|
6
6
|
|
|
7
|
-
A pack, and nothing but entries.
|
|
7
|
+
A pack, and nothing but entries. Each one says what a resource is, and what its own words mean in the terms suss compares boundaries in.
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
import { terraformFileToSummaries } from "@suss/contract-terraform";
|
|
@@ -21,14 +21,18 @@ const summaries = terraformFileToSummaries("infra/terraform/monitoring", {
|
|
|
21
21
|
|
|
22
22
|
| Resource | Becomes |
|
|
23
23
|
| --- | --- |
|
|
24
|
+
| `google_storage_bucket` | a store whose objects have no fields to compare against, under the name code passes to `bucket()` |
|
|
25
|
+
| `google_redis_instance` | a Redis store with no container to pair on; see below |
|
|
24
26
|
| `google_logging_metric` | a metric, identified by the type Cloud Monitoring gives it, `logging.googleapis.com/user/<name>` |
|
|
25
27
|
| `google_monitoring_alert_policy` | one consumer of a metric per `condition_threshold`, identified by the `metric.type` its filter states |
|
|
26
28
|
|
|
27
29
|
Everything else a configuration declares is skipped.
|
|
28
30
|
|
|
31
|
+
A bucket pairs by name: `@suss/framework-gcs` records the bucket an access reaches, and the `name` attribute is the same string, so `suss check` compares the two sides. A Memorystore instance does not: code addresses Redis by key namespace, no attribute of the instance declares one, and a match on the instance's own name would be a coincidence, so the summary declares the store with no container name and the storage check claims no access for it. The `@suss/terraform-aws` README walks through the same decision for ElastiCache.
|
|
32
|
+
|
|
29
33
|
## The pair the provider refuses
|
|
30
34
|
|
|
31
|
-
A log-based metric can declare that each measurement is a
|
|
35
|
+
A log-based metric can declare that each measurement is a histogram of buckets:
|
|
32
36
|
|
|
33
37
|
```hcl
|
|
34
38
|
resource "google_logging_metric" "sweep_refused" {
|
|
@@ -53,7 +57,7 @@ condition_threshold {
|
|
|
53
57
|
|
|
54
58
|
Both blocks are well formed, `terraform validate` and `terraform plan` both pass, and the apply fails minutes in: a distribution has no single value to compare, and Cloud Monitoring wants an aligner such as `ALIGN_PERCENTILE_95` to reduce each window to one number first.
|
|
55
59
|
|
|
56
|
-
The entries say that `value_type = "DISTRIBUTION"` means the measurements are a
|
|
60
|
+
The entries say that `value_type = "DISTRIBUTION"` means the measurements are a histogram, that a `threshold_value` means the condition compares against a single number, and that the four percentile aligners are the ones that reduce a window to a number. `checkMetric` puts those together and reports the pair as a `boundaryShapeMismatch` at error severity, naming `aggregations.per_series_aligner` and the four values that would fix it.
|
|
57
61
|
|
|
58
62
|
A condition that states one of the percentile aligners is left alone, as is a condition on a metric declared as `INT64` or `DOUBLE`.
|
|
59
63
|
|
package/dist/index.cjs
CHANGED
|
@@ -29,12 +29,12 @@ var METRIC_SYSTEM = "cloud-monitoring";
|
|
|
29
29
|
var VALUE_TYPES = {
|
|
30
30
|
INT64: "number",
|
|
31
31
|
DOUBLE: "number",
|
|
32
|
-
DISTRIBUTION: "
|
|
32
|
+
DISTRIBUTION: "histogram"
|
|
33
33
|
};
|
|
34
34
|
var METRIC_KINDS = {
|
|
35
|
-
GAUGE: "
|
|
36
|
-
DELTA: "
|
|
37
|
-
CUMULATIVE: "
|
|
35
|
+
GAUGE: "gauge",
|
|
36
|
+
DELTA: "delta",
|
|
37
|
+
CUMULATIVE: "cumulative"
|
|
38
38
|
};
|
|
39
39
|
var ALIGNERS = {
|
|
40
40
|
ALIGN_PERCENTILE_99: "number",
|
|
@@ -47,6 +47,32 @@ function googleTerraform() {
|
|
|
47
47
|
name: "terraform-gcp",
|
|
48
48
|
provider: "google",
|
|
49
49
|
resources: [
|
|
50
|
+
{
|
|
51
|
+
resource: "google_storage_bucket",
|
|
52
|
+
providerVersions: CURRENT,
|
|
53
|
+
boundary: {
|
|
54
|
+
kind: "storage",
|
|
55
|
+
storageSystem: "gcs",
|
|
56
|
+
// The name is what code passes to `bucket()`, so it is the
|
|
57
|
+
// identity both sides spell.
|
|
58
|
+
nameAttribute: "name",
|
|
59
|
+
// An object has no fields to compare a read against.
|
|
60
|
+
fieldSet: "none"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
resource: "google_redis_instance",
|
|
65
|
+
providerVersions: CURRENT,
|
|
66
|
+
boundary: {
|
|
67
|
+
kind: "storage",
|
|
68
|
+
storageSystem: "redis",
|
|
69
|
+
// Code addresses key namespaces, which no attribute of the
|
|
70
|
+
// instance lists, so it declares the store and claims no
|
|
71
|
+
// access. The README says how the sides meet.
|
|
72
|
+
declares: "store",
|
|
73
|
+
fieldSet: "none"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
50
76
|
{
|
|
51
77
|
resource: "google_logging_metric",
|
|
52
78
|
providerVersions: CURRENT,
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ var METRIC_SYSTEM = "cloud-monitoring";
|
|
|
4
4
|
var VALUE_TYPES = {
|
|
5
5
|
INT64: "number",
|
|
6
6
|
DOUBLE: "number",
|
|
7
|
-
DISTRIBUTION: "
|
|
7
|
+
DISTRIBUTION: "histogram"
|
|
8
8
|
};
|
|
9
9
|
var METRIC_KINDS = {
|
|
10
|
-
GAUGE: "
|
|
11
|
-
DELTA: "
|
|
12
|
-
CUMULATIVE: "
|
|
10
|
+
GAUGE: "gauge",
|
|
11
|
+
DELTA: "delta",
|
|
12
|
+
CUMULATIVE: "cumulative"
|
|
13
13
|
};
|
|
14
14
|
var ALIGNERS = {
|
|
15
15
|
ALIGN_PERCENTILE_99: "number",
|
|
@@ -22,6 +22,32 @@ function googleTerraform() {
|
|
|
22
22
|
name: "terraform-gcp",
|
|
23
23
|
provider: "google",
|
|
24
24
|
resources: [
|
|
25
|
+
{
|
|
26
|
+
resource: "google_storage_bucket",
|
|
27
|
+
providerVersions: CURRENT,
|
|
28
|
+
boundary: {
|
|
29
|
+
kind: "storage",
|
|
30
|
+
storageSystem: "gcs",
|
|
31
|
+
// The name is what code passes to `bucket()`, so it is the
|
|
32
|
+
// identity both sides spell.
|
|
33
|
+
nameAttribute: "name",
|
|
34
|
+
// An object has no fields to compare a read against.
|
|
35
|
+
fieldSet: "none"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
resource: "google_redis_instance",
|
|
40
|
+
providerVersions: CURRENT,
|
|
41
|
+
boundary: {
|
|
42
|
+
kind: "storage",
|
|
43
|
+
storageSystem: "redis",
|
|
44
|
+
// Code addresses key namespaces, which no attribute of the
|
|
45
|
+
// instance lists, so it declares the store and claims no
|
|
46
|
+
// access. The README says how the sides meet.
|
|
47
|
+
declares: "store",
|
|
48
|
+
fieldSet: "none"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
25
51
|
{
|
|
26
52
|
resource: "google_logging_metric",
|
|
27
53
|
providerVersions: CURRENT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/terraform-gcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "What Google Cloud's Terraform provider declares, for the Terraform contract reader.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@suss/behavioral-ir": "0.
|
|
48
|
-
"@suss/contract-terraform": "0.
|
|
47
|
+
"@suss/behavioral-ir": "0.11.0",
|
|
48
|
+
"@suss/contract-terraform": "0.11.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@suss/checker": "*",
|