hashicorp / terraform-plugin-codegen-spec

Terraform Provider Code Generation Specification and Go Bindings
Mozilla Public License 2.0
7 stars 4 forks source link

Adding regexp for identifier names #48

Closed bendbennett closed 11 months ago

bendbennett commented 11 months ago

This PR adds a JSON schema definition for a regular expression that conforms to the requirements for a Terraform configuration language identifier.

    "valid_identifier": {
      "type": "string",
      "pattern": "^[a-z_][a-z0-9_]*$"
    }

This validation has been added to all data source, provider and resource names, and all attribute and block names.

For example:

    "datasource": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "$ref": "#/$defs/valid_identifier"
        },
        "schema": {
          "type": "object",
          "$ref": "#/$defs/datasource_schema"
        }
      },
      "required": [
        "name",
        "schema"
      ]
    },
github-actions[bot] commented 3 months ago

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.