{"record":{"id":"43e7c1d77bb6a760","repo":"hashicorp/terraform","slug":"q-cannot-be-lower-than-d-d","errorCode":null,"errorMessage":"%q cannot be lower than %d: %d","messagePattern":"%q cannot be lower than (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/backend/remote-state/cos/backend.go","lineNumber":256,"sourceCode":"\t\t\t\tType:        schema.TypeString,\n\t\t\t\tOptional:    true,\n\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(PROVIDER_CAM_ROLE_NAME, nil),\n\t\t\t\tDescription: \"The name of the CVM instance CAM role. It can be sourced from the `TENCENTCLOUD_CAM_ROLE_NAME` environment variable.\",\n\t\t\t},\n\t\t},\n\t}\n\n\tresult := &Backend{Backend: s}\n\tresult.Backend.ConfigureFunc = result.configure\n\n\treturn result\n}\n\nfunc validateIntegerInRange(min, max int64) schema.SchemaValidateFunc {\n\treturn func(v interface{}, k string) (ws []string, errors []error) {\n\t\tvalue := int64(v.(int))\n\t\tif value < min {\n\t\t\terrors = append(errors, fmt.Errorf(\n\t\t\t\t\"%q cannot be lower than %d: %d\", k, min, value))\n\t\t}\n\t\tif value > max {\n\t\t\terrors = append(errors, fmt.Errorf(\n\t\t\t\t\"%q cannot be higher than %d: %d\", k, max, value))\n\t\t}\n\t\treturn\n\t}\n}\n\n// configure init cos client\nfunc (b *Backend) configure(ctx context.Context) error {\n\tif b.cosClient != nil {\n\t\treturn nil\n\t}\n\n\tb.cosContext = ctx\n\tdata := schema.FromContextBackendConfig(b.cosContext)","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/backend/remote-state/cos/backend.go#L238-L274","documentation":"Produced by validateIntegerInRange (cos/backend.go:256), used to validate assume_role.session_duration (range 0..43200). It fires when the configured integer is below the minimum, indicating a misconfigured assume-role session length.","triggerScenarios":"Setting assume_role.session_duration to a negative value (or via TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION env var below 0) triggers the < min branch.","commonSituations":"Typo producing a negative number; confusing units (minutes vs seconds); env var set to an invalid string that Atoi turns into a negative.","solutions":["Set session_duration to a value between 0 and 43200 seconds.","Use the default of 7200 seconds unless you need shorter/longer STS sessions.","Double-check TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION if set via environment."],"exampleFix":"// before\nassume_role {\n  role_arn         = \"qcs::cam::uin/1:roleName/tfrole\"\n  session_name     = \"tf\"\n  session_duration = -100\n}\n// after\nassume_role {\n  role_arn         = \"qcs::cam::uin/1:roleName/tfrole\"\n  session_name     = \"tf\"\n  session_duration = 7200\n}","handlingStrategy":"validation","validationCode":"// Validate session_duration is within [min,max] before configuring\nfunc validateRange(name string, v, minV, maxV int64) error {\n    if v < minV { return fmt.Errorf(\"%q cannot be lower than %d: %d\", name, minV, v) }\n    if v > maxV { return fmt.Errorf(\"%q cannot be higher than %d: %d\", name, maxV, v) }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember session_duration is in seconds (0..43200).","Prefer the default 7200 unless a longer STS session is required.","Sanity-check TENCENTCLOUD_ASSUME_ROLE_SESSION_DURATION in CI env."],"tags":["cos","tencentcloud","validation","config","assume-role","sts"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}