diff --git a/Cargo.lock b/Cargo.lock index 4b0140f07..86a6840a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,6 +284,7 @@ dependencies = [ "tree-sitter-fsharp", "tree-sitter-go", "tree-sitter-haskell", + "tree-sitter-hcl", "tree-sitter-html", "tree-sitter-java", "tree-sitter-javascript", @@ -1132,6 +1133,16 @@ dependencies = [ "tree-sitter-language", ] +[[package]] +name = "tree-sitter-hcl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a7b2cc3d7121553b84309fab9d11b3ff3d420403eef9ae50f9fd1cd9d9cf012" +dependencies = [ + "cc", + "tree-sitter-language", +] + [[package]] name = "tree-sitter-html" version = "0.23.2" diff --git a/Cargo.toml b/Cargo.toml index 674549243..719ccab01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,6 +87,7 @@ tree-sitter-erlang = "0.13.0" tree-sitter-fsharp = "0.1.0" tree-sitter-go = "0.23.4" tree-sitter-haskell = "0.23.1" +tree-sitter-hcl = "1.1.0" tree-sitter-html = "0.23.2" tree-sitter-java = "0.23.4" tree-sitter-javascript = "0.23.1" diff --git a/build.rs b/build.rs index 6f2d416fc..a68388628 100644 --- a/build.rs +++ b/build.rs @@ -122,11 +122,6 @@ fn main() { src_dir: "vendored_parsers/tree-sitter-hare-src", extra_files: vec![], }, - TreeSitterParser { - name: "tree-sitter-hcl", - src_dir: "vendored_parsers/tree-sitter-hcl-src", - extra_files: vec!["scanner.cc"], - }, TreeSitterParser { name: "tree-sitter-janet-simple", src_dir: "vendored_parsers/tree-sitter-janet-simple-src", diff --git a/manual/src/languages_supported.md b/manual/src/languages_supported.md index 2a422875f..000fcf049 100644 --- a/manual/src/languages_supported.md +++ b/manual/src/languages_supported.md @@ -65,7 +65,7 @@ with `difft --list-languages`. | Language | Parser Used | |----------|---------------------------------------------------------------------------------------------------| | CSS | [tree-sitter/tree-sitter-css](https://github.com/tree-sitter/tree-sitter-css) | -| HCL | [MichaHoffmann/tree-sitter-hcl](https://github.com/MichaHoffmann/tree-sitter-hcl) | +| HCL | [tree-sitter-grammars/tree-sitter-hcl](https://github.com/tree-sitter-grammars/tree-sitter-hcl) | | HTML | [tree-sitter/tree-sitter-html](https://github.com/tree-sitter/tree-sitter-html) | | JSON | [tree-sitter/tree-sitter-json](https://github.com/tree-sitter/tree-sitter-json) | | LaTeX | [latex-lsp/tree-sitter-latex](https://github.com/latex-lsp/tree-sitter-latex) | diff --git a/src/parse/tree_sitter_parser.rs b/src/parse/tree_sitter_parser.rs index 3a0904ddf..dd6d243bd 100644 --- a/src/parse/tree_sitter_parser.rs +++ b/src/parse/tree_sitter_parser.rs @@ -81,7 +81,6 @@ extern "C" { fn tree_sitter_gleam() -> ts::Language; fn tree_sitter_hare() -> ts::Language; fn tree_sitter_hack() -> ts::Language; - fn tree_sitter_hcl() -> ts::Language; fn tree_sitter_janet_simple() -> ts::Language; fn tree_sitter_kotlin() -> ts::Language; fn tree_sitter_latex() -> ts::Language; @@ -477,7 +476,8 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig { } } Hcl => { - let language = unsafe { tree_sitter_hcl() }; + let language_fn = tree_sitter_hcl::LANGUAGE; + let language = tree_sitter::Language::new(language_fn); TreeSitterConfig { language: language.clone(), atom_nodes: ["string_lit", "heredoc_template"].into_iter().collect(), diff --git a/vendored_parsers/tree-sitter-hcl-src b/vendored_parsers/tree-sitter-hcl-src deleted file mode 120000 index d0db752ec..000000000 --- a/vendored_parsers/tree-sitter-hcl-src +++ /dev/null @@ -1 +0,0 @@ -tree-sitter-hcl/src \ No newline at end of file diff --git a/vendored_parsers/tree-sitter-hcl/.editorconfig b/vendored_parsers/tree-sitter-hcl/.editorconfig deleted file mode 100644 index 22114f732..000000000 --- a/vendored_parsers/tree-sitter-hcl/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -root = true - -[*.{cc,txt,js}] -indent_style = space -indent_size = 2 -tab_width = 8 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -charset = utf-8 diff --git a/vendored_parsers/tree-sitter-hcl/.github/ISSUE_TEMPLATE/bug_report.md b/vendored_parsers/tree-sitter-hcl/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index b2b03cf2e..000000000 --- a/vendored_parsers/tree-sitter-hcl/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Write HCL -2. ??? -3. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Additional context** -Add any other context about the problem here. diff --git a/vendored_parsers/tree-sitter-hcl/.github/ISSUE_TEMPLATE/feature_request.md b/vendored_parsers/tree-sitter-hcl/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d6..000000000 --- a/vendored_parsers/tree-sitter-hcl/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/vendored_parsers/tree-sitter-hcl/.github/workflows/acceptance.yaml b/vendored_parsers/tree-sitter-hcl/.github/workflows/acceptance.yaml deleted file mode 100644 index a2512d2e4..000000000 --- a/vendored_parsers/tree-sitter-hcl/.github/workflows/acceptance.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: acceptance -on: [pull_request] - -jobs: - unittests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: nixbuild/nix-quick-install-action@v5 - - run: nix-shell --run 'tree-sitter test' - acceptance: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: nixbuild/nix-quick-install-action@v5 - - run: nix-shell --run 'tree-sitter parse --quiet --stat example/real_world_stuff/*/*' diff --git a/vendored_parsers/tree-sitter-hcl/.github/workflows/build.yaml b/vendored_parsers/tree-sitter-hcl/.github/workflows/build.yaml deleted file mode 100644 index 99d5f65b4..000000000 --- a/vendored_parsers/tree-sitter-hcl/.github/workflows/build.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: build - -on: [pull_request] - -jobs: - compile: - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - compiler: [gcc, clang++] - - name: compile - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - - if: matrix.os == 'windows-latest' && matrix.compiler == 'gcc' - uses: egor-tensin/setup-mingw@v2 - - - name: build - run: ${{ matrix.compiler }} -o scanner.o -I./src -c src/scanner.cc -Werror diff --git a/vendored_parsers/tree-sitter-hcl/.gitignore b/vendored_parsers/tree-sitter-hcl/.gitignore deleted file mode 100644 index bd4ba95f8..000000000 --- a/vendored_parsers/tree-sitter-hcl/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -node_modules -queries -package-lock.json -build -target -Cargo.lock -npm-debug.log -log.html -.env -.DS_Store diff --git a/vendored_parsers/tree-sitter-hcl/CHANGELOG.md b/vendored_parsers/tree-sitter-hcl/CHANGELOG.md deleted file mode 100644 index 6d169a688..000000000 --- a/vendored_parsers/tree-sitter-hcl/CHANGELOG.md +++ /dev/null @@ -1,71 +0,0 @@ -# Changelog - -## 0.7.0 - 2022-06-02 - -housekeeping: -* bump tree-sitter dependency to 0.20.6 -* regenerate parser -* fix clang+windows CI job - -fix: -* allow empty string literals - -## 0.6.0 - 2021-09-20 - -feature: -* add template for expressions -* add template if expressions - -cleanup: -* move fuzzing instrumentation to different repository - -## 0.5.0 - 2021-09-15 - -feature: -* unhide `(block|object|tuple)_(start|end)` tokens - -fix: -* remove empty `template_directive` block because it causes issues for semgrep - -## 0.4.0 - 2021-07-02 - -feature: -* add named "key" and "val" fields to left and right side of object elements -* unhide the `template_interpolation_(start|end)` and `quoted_template_(start|end)` tokens - -## 0.3.2 - 2021-07-01 - -fix: -* add a build step to CI to make sure the scanner is compilable -* add fuzzing instrumentation - -## 0.3.1 - 2021-06-30 - -fix: -* dont use c struct initializer syntax in src/scanner.cc - -## 0.3.0 - 2021-06-28 - -fix: -* correct expression for identifiers -* allow empty template interpolations -* allow empty templates -* fix crash when `context_stack.size()` exceeds `CHAR_MAX` -* fix crash when `heredoc_identifier.size()` exceeds `CHAR_MAX` - -quality: -* add fuzzing - -## 0.2.0 - 2021-06-26 - -feature: -* add quoted templates and heredoc templates -* still missing template directives though - -quality: -* collect corpus of real world hcl files from github -* add github actions - -## 0.1.0 - 2021-06-13 - -* initial version diff --git a/vendored_parsers/tree-sitter-hcl/Cargo.toml b/vendored_parsers/tree-sitter-hcl/Cargo.toml deleted file mode 100644 index e9ef247ec..000000000 --- a/vendored_parsers/tree-sitter-hcl/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "tree-sitter-hcl" -description = "hcl grammar for the tree-sitter parsing library" -version = "0.0.1" -keywords = ["incremental", "parsing", "hcl"] -categories = ["parsing", "text-editors"] -repository = "https://github.com/MichaHoffmann/tree-sitter-hcl" -edition = "2018" -license = "Apache" - -build = "bindings/rust/build.rs" -include = [ - "bindings/rust/*", - "grammar.js", - "queries/*", - "src/*", -] - -[lib] -path = "bindings/rust/lib.rs" - -[dependencies] -tree-sitter = "~0.20" - -[build-dependencies] -cc = "1.0" diff --git a/vendored_parsers/tree-sitter-hcl/LICENSE b/vendored_parsers/tree-sitter-hcl/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendored_parsers/tree-sitter-hcl/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendored_parsers/tree-sitter-hcl/README.md b/vendored_parsers/tree-sitter-hcl/README.md deleted file mode 100644 index 42390aac6..000000000 --- a/vendored_parsers/tree-sitter-hcl/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# tree-sitter-hcl - -tree-sitter grammar for the [HCL](https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md) language - -## Try It Out - -Try the parser in the [playground](https://michahoffmann.github.io/tree-sitter-hcl/) - -## Example - -Highlighting `example/example.hcl`: - -![Highlighting Example](https://i.imgur.com/yUJ0ybK.png) - -## Developing - -It is recommended to use `nix` to fulfill all development dependencies. To activate the development environment simply run `nix-shell` in the project root. - -## Running Tests - -To run tests simply run `nix-shell --run 'tree-sitter test'`. - -## Compliance - -The directory `example/real_world_stuff` contains a corpus of hcl files that I found with the github query `language:HCL` for users `coreos`, `hashicorp`, `oracle` and `terraform-community-modules`. - -```bash -tree-sitter parse --quiet --stat example/real_world_stuff/*/* - -Total parses: 1892; successful parses: 1892; failed parses: 0; success percentage: 100.00% -``` - -## Fuzzing - -See the [fuzzing repo for this parser](https://github.com/MichaHoffmann/tree-sitter-hcl-fuzz) - -## Attributions - -Pages were copied from https://github.com/m-novikov/tree-sitter-sql diff --git a/vendored_parsers/tree-sitter-hcl/binding.gyp b/vendored_parsers/tree-sitter-hcl/binding.gyp deleted file mode 100644 index f135dc05f..000000000 --- a/vendored_parsers/tree-sitter-hcl/binding.gyp +++ /dev/null @@ -1,19 +0,0 @@ -{ - "targets": [ - { - "target_name": "tree_sitter_hcl_binding", - "include_dirs": [ - " -#include "nan.h" - -using namespace v8; - -extern "C" TSLanguage * tree_sitter_hcl(); - -namespace { - -NAN_METHOD(New) {} - -void Init(Local exports, Local module) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("Language").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); - Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_hcl()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("hcl").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); -} - -NODE_MODULE(tree_sitter_hcl_binding, Init) - -} // namespace diff --git a/vendored_parsers/tree-sitter-hcl/bindings/node/index.js b/vendored_parsers/tree-sitter-hcl/bindings/node/index.js deleted file mode 100644 index 8cf95f1a6..000000000 --- a/vendored_parsers/tree-sitter-hcl/bindings/node/index.js +++ /dev/null @@ -1,19 +0,0 @@ -try { - module.exports = require("../../build/Release/tree_sitter_hcl_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_hcl_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} - -try { - module.exports.nodeTypeInfo = require("../../src/node-types.json"); -} catch (_) {} diff --git a/vendored_parsers/tree-sitter-hcl/bindings/rust/build.rs b/vendored_parsers/tree-sitter-hcl/bindings/rust/build.rs deleted file mode 100644 index 673642f52..000000000 --- a/vendored_parsers/tree-sitter-hcl/bindings/rust/build.rs +++ /dev/null @@ -1,35 +0,0 @@ -fn main() { - let src_dir = std::path::Path::new("src"); - - let mut c_config = cc::Build::new(); - c_config.include(&src_dir); - c_config - .flag_if_supported("-Wno-unused-parameter") - .flag_if_supported("-Wno-unused-but-set-variable") - .flag_if_supported("-Wno-trigraphs"); - let parser_path = src_dir.join("parser.c"); - c_config.file(&parser_path); - - // If your language uses an external scanner written in C, - // then include this block of code: - - /* - let scanner_path = src_dir.join("scanner.c"); - c_config.file(&scanner_path); - println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); - */ - - c_config.compile("parser"); - println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); - - let mut cpp_config = cc::Build::new(); - cpp_config.cpp(true); - cpp_config.include(&src_dir); - cpp_config - .flag_if_supported("-Wno-unused-parameter") - .flag_if_supported("-Wno-unused-but-set-variable"); - let scanner_path = src_dir.join("scanner.cc"); - cpp_config.file(&scanner_path); - cpp_config.compile("scanner"); - println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); -} diff --git a/vendored_parsers/tree-sitter-hcl/bindings/rust/lib.rs b/vendored_parsers/tree-sitter-hcl/bindings/rust/lib.rs deleted file mode 100644 index 3eaa9c0f9..000000000 --- a/vendored_parsers/tree-sitter-hcl/bindings/rust/lib.rs +++ /dev/null @@ -1,52 +0,0 @@ -//! This crate provides hcl language support for the [tree-sitter][] parsing library. -//! -//! Typically, you will use the [language][language func] function to add this language to a -//! tree-sitter [Parser][], and then use the parser to parse some code: -//! -//! ``` -//! let code = ""; -//! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_hcl::language()).expect("Error loading hcl grammar"); -//! let tree = parser.parse(code, None).unwrap(); -//! ``` -//! -//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -//! [language func]: fn.language.html -//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html -//! [tree-sitter]: https://tree-sitter.github.io/ - -use tree_sitter::Language; - -extern "C" { - fn tree_sitter_hcl() -> Language; -} - -/// Get the tree-sitter [Language][] for this grammar. -/// -/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -pub fn language() -> Language { - unsafe { tree_sitter_hcl() } -} - -/// The content of the [`node-types.json`][] file for this grammar. -/// -/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types -pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json"); - -// Uncomment these to include any queries that this grammar contains - -// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm"); -// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm"); -// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm"); -// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm"); - -#[cfg(test)] -mod tests { - #[test] - fn test_can_load_grammar() { - let mut parser = tree_sitter::Parser::new(); - parser - .set_language(super::language()) - .expect("Error loading hcl language"); - } -} diff --git a/vendored_parsers/tree-sitter-hcl/docs/index.html b/vendored_parsers/tree-sitter-hcl/docs/index.html deleted file mode 100644 index 43479e896..000000000 --- a/vendored_parsers/tree-sitter-hcl/docs/index.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Tree Sitter HCL Playground - - - - - - - - -
-

Tree Sitter HCL Playground

-

Code

-
- - - - - -
- - - - - -

Tree

- -
-

-      
- -
- - - - - - - - diff --git a/vendored_parsers/tree-sitter-hcl/docs/playground.js b/vendored_parsers/tree-sitter-hcl/docs/playground.js deleted file mode 100644 index a297500af..000000000 --- a/vendored_parsers/tree-sitter-hcl/docs/playground.js +++ /dev/null @@ -1,498 +0,0 @@ -// This file is licensed under MIT license -// Copyright (c) 2018 Max Brunsfeld -// Taken from https://github.com/tree-sitter/tree-sitter/docs/assets/playground.js -let tree; - -(async () => { - const CAPTURE_REGEX = /@\s*([\w\._-]+)/g; - const COLORS_BY_INDEX = [ - "blue", - "chocolate", - "darkblue", - "darkcyan", - "darkgreen", - "darkred", - "darkslategray", - "dimgray", - "green", - "indigo", - "navy", - "red", - "sienna", - ]; - - const scriptURL = document.getElementById("playground-script").src; - - const codeInput = document.getElementById("code-input"); - const loggingCheckbox = document.getElementById("logging-checkbox"); - const outputContainer = document.getElementById("output-container"); - const outputContainerScroll = document.getElementById( - "output-container-scroll", - ); - const playgroundContainer = document.getElementById("playground-container"); - const queryCheckbox = document.getElementById("query-checkbox"); - const createIssueBtn = document.getElementById("create-issue-btn"); - const queryContainer = document.getElementById("query-container"); - const queryInput = document.getElementById("query-input"); - const updateTimeSpan = document.getElementById("update-time"); - - loadState(); - - await TreeSitter.init(); - - const parser = new TreeSitter(); - const codeEditor = CodeMirror.fromTextArea(codeInput, { - lineNumbers: true, - showCursorWhenSelecting: true, - }); - - const queryEditor = CodeMirror.fromTextArea(queryInput, { - lineNumbers: true, - showCursorWhenSelecting: true, - }); - - const cluster = new Clusterize({ - rows: [], - noDataText: null, - contentElem: outputContainer, - scrollElem: outputContainerScroll, - }); - const renderTreeOnCodeChange = debounce(renderTree, 50); - const saveStateOnChange = debounce(saveState, 2000); - const runTreeQueryOnChange = debounce(runTreeQuery, 50); - - let languageName = "hcl"; - let treeRows = null; - let treeRowHighlightedIndex = -1; - let parseCount = 0; - let isRendering = 0; - let query; - - codeEditor.on("changes", handleCodeChange); - codeEditor.on("viewportChange", runTreeQueryOnChange); - codeEditor.on("cursorActivity", debounce(handleCursorMovement, 150)); - queryEditor.on("changes", debounce(handleQueryChange, 150)); - - loggingCheckbox.addEventListener("change", handleLoggingChange); - queryCheckbox.addEventListener("change", handleQueryEnableChange); - outputContainer.addEventListener("click", handleTreeClick); - createIssueBtn.addEventListener("click", handleCreateIssue); - handleQueryEnableChange(); - await loadLanguage(); - - playgroundContainer.style.visibility = "visible"; - - async function loadLanguage() { - const query = new URL(scriptURL).search; - const url = `tree-sitter-hcl.wasm${query}`; - const language = await TreeSitter.Language.load(url); - tree = null; - parser.setLanguage(language); - handleCodeChange(); - handleQueryChange(); - } - - async function handleCodeChange(editor, changes) { - const newText = codeEditor.getValue() + "\n"; - const edits = tree && changes && changes.map(treeEditForEditorChange); - - const start = performance.now(); - if (edits) { - for (const edit of edits) { - tree.edit(edit); - } - } - const newTree = parser.parse(newText, tree); - const duration = (performance.now() - start).toFixed(1); - - updateTimeSpan.innerText = `${duration} ms`; - if (tree) tree.delete(); - tree = newTree; - parseCount++; - renderTreeOnCodeChange(); - runTreeQueryOnChange(); - saveStateOnChange(); - } - - async function renderTree() { - isRendering++; - const cursor = tree.walk(); - - let currentRenderCount = parseCount; - let row = ""; - let rows = []; - let finishedRow = false; - let visitedChildren = false; - let indentLevel = 0; - - for (let i = 0; ; i++) { - if (i > 0 && i % 10000 === 0) { - await new Promise(r => setTimeout(r, 0)); - if (parseCount !== currentRenderCount) { - cursor.delete(); - isRendering--; - return; - } - } - - let displayName; - if (cursor.nodeIsMissing) { - displayName = `MISSING ${cursor.nodeType}`; - } else if (cursor.nodeIsNamed) { - displayName = cursor.nodeType; - } - - if (visitedChildren) { - if (displayName) { - finishedRow = true; - } - - if (cursor.gotoNextSibling()) { - visitedChildren = false; - } else if (cursor.gotoParent()) { - visitedChildren = true; - indentLevel--; - } else { - break; - } - } else { - if (displayName) { - if (finishedRow) { - row += ""; - rows.push(row); - finishedRow = false; - } - const start = cursor.startPosition; - const end = cursor.endPosition; - const id = cursor.nodeId; - let fieldName = cursor.currentFieldName(); - if (fieldName) { - fieldName += ": "; - } else { - fieldName = ""; - } - row = `
${" ".repeat( - indentLevel, - )}${fieldName}${displayName} [${ - start.row - }, ${start.column}] - [${end.row}, ${end.column}])`; - finishedRow = true; - } - - if (cursor.gotoFirstChild()) { - visitedChildren = false; - indentLevel++; - } else { - visitedChildren = true; - } - } - } - if (finishedRow) { - row += "
"; - rows.push(row); - } - - cursor.delete(); - cluster.update(rows); - treeRows = rows; - isRendering--; - handleCursorMovement(); - } - - function runTreeQuery(_, startRow, endRow) { - if (endRow == null) { - const viewport = codeEditor.getViewport(); - startRow = viewport.from; - endRow = viewport.to; - } - - codeEditor.operation(() => { - const marks = codeEditor.getAllMarks(); - marks.forEach(m => m.clear()); - - if (tree && query) { - const captures = query.captures( - tree.rootNode, - { row: startRow, column: 0 }, - { row: endRow, column: 0 }, - ); - let lastNodeId; - for (const { name, node } of captures) { - if (node.id === lastNodeId) continue; - lastNodeId = node.id; - const { startPosition, endPosition } = node; - codeEditor.markText( - { line: startPosition.row, ch: startPosition.column }, - { line: endPosition.row, ch: endPosition.column }, - { - inclusiveLeft: true, - inclusiveRight: true, - css: `color: ${colorForCaptureName(name)}`, - }, - ); - } - } - }); - } - - function handleQueryChange() { - if (query) { - query.delete(); - query.deleted = true; - query = null; - } - - queryEditor.operation(() => { - queryEditor.getAllMarks().forEach(m => m.clear()); - if (!queryCheckbox.checked) return; - - const queryText = queryEditor.getValue(); - - try { - query = parser.getLanguage().query(queryText); - let match; - - let row = 0; - queryEditor.eachLine(line => { - while ((match = CAPTURE_REGEX.exec(line.text))) { - queryEditor.markText( - { line: row, ch: match.index }, - { line: row, ch: match.index + match[0].length }, - { - inclusiveLeft: true, - inclusiveRight: true, - css: `color: ${colorForCaptureName(match[1])}`, - }, - ); - } - row++; - }); - } catch (error) { - const startPosition = queryEditor.posFromIndex(error.index); - const endPosition = { - line: startPosition.line, - ch: startPosition.ch + (error.length || Infinity), - }; - - if (error.index === queryText.length) { - if (startPosition.ch > 0) { - startPosition.ch--; - } else if (startPosition.row > 0) { - startPosition.row--; - startPosition.column = Infinity; - } - } - - queryEditor.markText(startPosition, endPosition, { - className: "query-error", - inclusiveLeft: true, - inclusiveRight: true, - attributes: { title: error.message }, - }); - } - }); - - runTreeQuery(); - saveQueryState(); - } - - function handleCursorMovement() { - if (isRendering) return; - - const selection = codeEditor.getDoc().listSelections()[0]; - let start = { row: selection.anchor.line, column: selection.anchor.ch }; - let end = { row: selection.head.line, column: selection.head.ch }; - if ( - start.row > end.row || - (start.row === end.row && start.column > end.column) - ) { - let swap = end; - end = start; - start = swap; - } - const node = tree.rootNode.namedDescendantForPosition(start, end); - if (treeRows) { - if (treeRowHighlightedIndex !== -1) { - const row = treeRows[treeRowHighlightedIndex]; - if (row) - treeRows[treeRowHighlightedIndex] = row.replace( - "highlighted", - "plain", - ); - } - treeRowHighlightedIndex = treeRows.findIndex(row => - row.includes(`data-id=${node.id}`), - ); - if (treeRowHighlightedIndex !== -1) { - const row = treeRows[treeRowHighlightedIndex]; - if (row) - treeRows[treeRowHighlightedIndex] = row.replace( - "plain", - "highlighted", - ); - } - cluster.update(treeRows); - const lineHeight = cluster.options.item_height; - const scrollTop = outputContainerScroll.scrollTop; - const containerHeight = outputContainerScroll.clientHeight; - const offset = treeRowHighlightedIndex * lineHeight; - if (scrollTop > offset - 20) { - $(outputContainerScroll).animate({ scrollTop: offset - 20 }, 150); - } else if (scrollTop < offset + lineHeight + 40 - containerHeight) { - $(outputContainerScroll).animate( - { scrollTop: offset - containerHeight + 40 }, - 150, - ); - } - } - } - - function handleCreateIssue() { - const queryText = codeEditor.getValue(); - const outputText = outputContainer.innerText; - const title = `Error parsing SQL`; - const body = `Error when parsing the following SQL: -\`\`\` -${queryText} -\`\`\` -Error: -\`\`\` -${outputText} -\`\`\``; - const queryParams = `title=${encodeURIComponent( - title, - )}&body=${encodeURIComponent(body)}`; - const url = `https://github.com/MichaHoffmann/tree-sitter-hcl/issues/new?${queryParams}`; - window.open(url); - } - - function handleTreeClick(event) { - if (event.target.tagName === "A") { - event.preventDefault(); - const [startRow, startColumn, endRow, endColumn] = - event.target.dataset.range.split(",").map(n => parseInt(n)); - codeEditor.focus(); - codeEditor.setSelection( - { line: startRow, ch: startColumn }, - { line: endRow, ch: endColumn }, - ); - } - } - - function handleLoggingChange() { - if (loggingCheckbox.checked) { - parser.setLogger((message, lexing) => { - if (lexing) { - console.log(" ", message); - } else { - console.log(message); - } - }); - } else { - parser.setLogger(null); - } - } - - function handleQueryEnableChange() { - if (queryCheckbox.checked) { - queryContainer.style.visibility = ""; - queryContainer.style.position = ""; - } else { - queryContainer.style.visibility = "hidden"; - queryContainer.style.position = "absolute"; - } - handleQueryChange(); - } - - function treeEditForEditorChange(change) { - const oldLineCount = change.removed.length; - const newLineCount = change.text.length; - const lastLineLength = change.text[newLineCount - 1].length; - - const startPosition = { row: change.from.line, column: change.from.ch }; - const oldEndPosition = { row: change.to.line, column: change.to.ch }; - const newEndPosition = { - row: startPosition.row + newLineCount - 1, - column: - newLineCount === 1 - ? startPosition.column + lastLineLength - : lastLineLength, - }; - - const startIndex = codeEditor.indexFromPos(change.from); - let newEndIndex = startIndex + newLineCount - 1; - let oldEndIndex = startIndex + oldLineCount - 1; - for (let i = 0; i < newLineCount; i++) newEndIndex += change.text[i].length; - for (let i = 0; i < oldLineCount; i++) - oldEndIndex += change.removed[i].length; - - return { - startIndex, - oldEndIndex, - newEndIndex, - startPosition, - oldEndPosition, - newEndPosition, - }; - } - - function colorForCaptureName(capture) { - const id = query.captureNames.indexOf(capture); - return COLORS_BY_INDEX[id % COLORS_BY_INDEX.length]; - } - - function storageGetItem(lookupKey) { - try { - return localStorage.getItem(lookupKey); - } catch { - return null; - } - } - - function storageSetItem(lookupKey, value) { - try { - return localStorage.setIem(lookupKey, value); - } catch {} - } - - function loadState() { - const language = storageGetItem("language"); - const sourceCode = storageGetItem("sourceCode"); - const query = storageGetItem("query"); - const queryEnabled = storageGetItem("queryEnabled"); - if (language != null && sourceCode != null && query != null) { - queryInput.value = query; - codeInput.value = sourceCode; - queryCheckbox.checked = queryEnabled === "true"; - } - } - - function saveState() { - storageSetItem("sourceCode", codeEditor.getValue()); - saveQueryState(); - } - - function saveQueryState() { - storageSetItem("queryEnabled", queryCheckbox.checked); - storageSetItem("query", queryEditor.getValue()); - } - - function debounce(func, wait, immediate) { - var timeout; - return function () { - var context = this, - args = arguments; - var later = function () { - timeout = null; - if (!immediate) func.apply(context, args); - }; - var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) func.apply(context, args); - }; - } -})(); - diff --git a/vendored_parsers/tree-sitter-hcl/docs/tree-sitter-hcl.wasm b/vendored_parsers/tree-sitter-hcl/docs/tree-sitter-hcl.wasm deleted file mode 100755 index f59ca3c23..000000000 Binary files a/vendored_parsers/tree-sitter-hcl/docs/tree-sitter-hcl.wasm and /dev/null differ diff --git a/vendored_parsers/tree-sitter-hcl/docs/vendor/tree-sitter.js b/vendored_parsers/tree-sitter-hcl/docs/vendor/tree-sitter.js deleted file mode 100644 index 81ee7f795..000000000 --- a/vendored_parsers/tree-sitter-hcl/docs/vendor/tree-sitter.js +++ /dev/null @@ -1 +0,0 @@ -var Module=void 0!==Module?Module:{},TreeSitter=function(){var e,t="object"==typeof window?{currentScript:window.document.currentScript}:null;class Parser{constructor(){this.initialize()}initialize(){throw new Error("cannot construct a Parser before calling `init()`")}static init(r){return e||(Module=Object.assign({},Module,r),e=new Promise(e=>{var r,n={};for(r in Module)Module.hasOwnProperty(r)&&(n[r]=Module[r]);var s,o,_=[],a="./this.program",u=function(e,t){throw t},i=!1,l=!1;i="object"==typeof window,l="function"==typeof importScripts,s="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,o=!i&&!s&&!l;var d,c,m,f,p,h="";s?(h=l?require("path").dirname(h)+"/":__dirname+"/",d=function(e,t){return f||(f=require("fs")),p||(p=require("path")),e=p.normalize(e),f.readFileSync(e,t?null:"utf8")},m=function(e){var t=d(e,!0);return t.buffer||(t=new Uint8Array(t)),k(t.buffer),t},process.argv.length>1&&(a=process.argv[1].replace(/\\/g,"/")),_=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=Module),u=function(e){process.exit(e)},Module.inspect=function(){return"[Emscripten Module object]"}):o?("undefined"!=typeof read&&(d=function(e){return read(e)}),m=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(k("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?_=scriptArgs:void 0!==arguments&&(_=arguments),"function"==typeof quit&&(u=function(e){quit(e)}),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(i||l)&&(l?h=self.location.href:void 0!==t&&t.currentScript&&(h=t.currentScript.src),h=0!==h.indexOf("blob:")?h.substr(0,h.lastIndexOf("/")+1):"",d=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},l&&(m=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),c=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});Module.print||console.log.bind(console);var g=Module.printErr||console.warn.bind(console);for(r in n)n.hasOwnProperty(r)&&(Module[r]=n[r]);n=null,Module.arguments&&(_=Module.arguments),Module.thisProgram&&(a=Module.thisProgram),Module.quit&&(u=Module.quit);var w=16;var y,M=[];function b(e,t){if(!y){y=new WeakMap;for(var r=0;r>0]=t;break;case"i16":L[e>>1]=t;break;case"i32":W[e>>2]=t;break;case"i64":ue=[t>>>0,(ae=t,+Math.abs(ae)>=1?ae>0?(0|Math.min(+Math.floor(ae/4294967296),4294967295))>>>0:~~+Math.ceil((ae-+(~~ae>>>0))/4294967296)>>>0:0)],W[e>>2]=ue[0],W[e+4>>2]=ue[1];break;case"float":O[e>>2]=t;break;case"double":Z[e>>3]=t;break;default:oe("invalid type for setValue: "+r)}}function N(e,t,r){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return R[e>>0];case"i16":return L[e>>1];case"i32":case"i64":return W[e>>2];case"float":return O[e>>2];case"double":return Z[e>>3];default:oe("invalid type for getValue: "+t)}return null}"object"!=typeof WebAssembly&&oe("no native wasm support detected");var P=!1;function k(e,t){e||oe("Assertion failed: "+t)}var C=1;var q,R,T,L,W,O,Z,F="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function $(e,t,r){for(var n=t+r,s=t;e[s]&&!(s>=n);)++s;if(s-t>16&&e.subarray&&F)return F.decode(e.subarray(t,s));for(var o="";t>10,56320|1023&i)}}else o+=String.fromCharCode((31&_)<<6|a)}else o+=String.fromCharCode(_)}return o}function j(e,t){return e?$(T,e,t):""}function U(e,t,r,n){if(!(n>0))return 0;for(var s=r,o=r+n-1,_=0;_=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++_);if(a<=127){if(r>=o)break;t[r++]=a}else if(a<=2047){if(r+1>=o)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=o)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=o)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-s}function D(e,t,r){return U(e,T,t,r)}function z(e){for(var t=0,r=0;r=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++r)),n<=127?++t:t+=n<=2047?2:n<=65535?3:4}return t}function G(e){var t=z(e)+1,r=ze(t);return U(e,R,r,t),r}function H(e){q=e,Module.HEAP8=R=new Int8Array(e),Module.HEAP16=L=new Int16Array(e),Module.HEAP32=W=new Int32Array(e),Module.HEAPU8=T=new Uint8Array(e),Module.HEAPU16=new Uint16Array(e),Module.HEAPU32=new Uint32Array(e),Module.HEAPF32=O=new Float32Array(e),Module.HEAPF64=Z=new Float64Array(e)}var B=Module.INITIAL_MEMORY||33554432;(A=Module.wasmMemory?Module.wasmMemory:new WebAssembly.Memory({initial:B/65536,maximum:32768}))&&(q=A.buffer),B=q.byteLength,H(q);var K=new WebAssembly.Table({initial:17,element:"anyfunc"}),V=[],X=[],Q=[],J=[],Y=!1;var ee=0,te=null,re=null;function ne(e){ee++,Module.monitorRunDependencies&&Module.monitorRunDependencies(ee)}function se(e){if(ee--,Module.monitorRunDependencies&&Module.monitorRunDependencies(ee),0==ee&&(null!==te&&(clearInterval(te),te=null),re)){var t=re;re=null,t()}}function oe(e){throw Module.onAbort&&Module.onAbort(e),g(e+=""),P=!0,1,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(e)}Module.preloadedImages={},Module.preloadedAudios={},Module.preloadedWasm={};var _e,ae,ue,ie="data:application/octet-stream;base64,";function le(e){return e.startsWith(ie)}function de(e){return e.startsWith("file://")}function ce(e){try{if(e==_e&&v)return new Uint8Array(v);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}catch(e){oe(e)}}le(_e="tree-sitter.wasm")||(_e=function(e){return Module.locateFile?Module.locateFile(e,h):h+e}(_e));var me={},fe={get:function(e,t){return me[t]||(me[t]=new WebAssembly.Global({value:"i32",mutable:!0})),me[t]}};function pe(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?K.get(r)():K.get(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(Module)}}function he(e){var t=0;function r(){for(var r=0,n=1;;){var s=e[t++];if(r+=(127&s)*n,n*=128,!(128&s))break}return r}if(e instanceof WebAssembly.Module){var n=WebAssembly.Module.customSections(e,"dylink");k(0!=n.length,"need dylink section"),e=new Int8Array(n[0])}else{k(1836278016==new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer)[0],"need to see wasm magic number"),k(0===e[8],"need the dylink section to be first"),t=9,r(),k(6===e[t]),k(e[++t]==="d".charCodeAt(0)),k(e[++t]==="y".charCodeAt(0)),k(e[++t]==="l".charCodeAt(0)),k(e[++t]==="i".charCodeAt(0)),k(e[++t]==="n".charCodeAt(0)),k(e[++t]==="k".charCodeAt(0)),t++}var s={};s.memorySize=r(),s.memoryAlign=r(),s.tableSize=r(),s.tableAlign=r();var o=r();s.neededDynlibs=[];for(var _=0;_0}function ye(e){return 0==e.indexOf("dynCall_")||["stackAlloc","stackSave","stackRestore"].includes(e)?e:"_"+e}function Me(e,t){for(var r in e)if(e.hasOwnProperty(r)){Fe.hasOwnProperty(r)||(Fe[r]=e[r]);var n=ye(r);Module.hasOwnProperty(n)||(Module[n]=e[r])}}var be={nextHandle:1,loadedLibs:{},loadedLibNames:{}};function ve(e,t,r){return e.includes("j")?function(e,t,r){var n=Module["dynCall_"+e];return r&&r.length?n.apply(null,[t].concat(r)):n.call(null,t)}(e,t,r):K.get(t).apply(null,r)}var Ee=5250880;function Ie(e){return["__cpp_exception","__wasm_apply_data_relocs","__dso_handle","__set_stack_limits"].includes(e)}function Ae(e,t){var r={};for(var n in e){var s=e[n];"object"==typeof s&&(s=s.value),"number"==typeof s&&(s+=t),r[n]=s}return function(e){for(var t in e)if(!Ie(t)){var r=!1,n=e[t];t.startsWith("orig$")&&(t=t.split("$")[1],r=!0),me[t]||(me[t]=new WebAssembly.Global({value:"i32",mutable:!0})),(r||0==me[t].value)&&("function"==typeof n?me[t].value=b(n):"number"==typeof n?me[t].value=n:g("unhandled export type for `"+t+"`: "+typeof n))}}(r),r}function Se(e,t){var r,n;return t&&(r=Fe["orig$"+e]),r||(r=Fe[e]),r||(r=Module[ye(e)]),!r&&e.startsWith("invoke_")&&(n=e.split("_")[1],r=function(){var e=Ue();try{return ve(n,arguments[0],Array.prototype.slice.call(arguments,1))}catch(t){if(De(e),t!==t+0&&"longjmp"!==t)throw t;Ge(1,0)}}),r}function xe(e,t){var r=he(e);function n(){var n=Math.pow(2,r.memoryAlign);n=Math.max(n,w);var s,o,_,a=(s=function(e){if(Y)return $e(e);var t=Ee,r=t+e+15&-16;return Ee=r,me.__heap_base.value=r,t}(r.memorySize+n),(o=n)||(o=w),Math.ceil(s/o)*o),u=K.length;K.grow(r.tableSize);for(var i=a;i>2]=n,-1;r=ke()}return W[t>>2]=r/1e3|0,W[t+4>>2]=r%1e3*1e3*1e3|0,0}function Le(e){try{return A.grow(e-q.byteLength+65535>>>16),H(A.buffer),1}catch(e){}}function We(e){Ve(e)}function Oe(e){E(e)}Te.sig="iii",We.sig="vi",Oe.sig="vi";var Ze,Fe={__heap_base:Ee,__indirect_function_table:K,__memory_base:1024,__stack_pointer:Ce,__table_base:1,abort:qe,clock_gettime:Te,emscripten_memcpy_big:function(e,t,r){T.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){var t,r,n=T.length;if((e>>>=0)>2147483648)return!1;for(var s=1;s<=4;s*=2){var o=n*(1+.2/s);if(o=Math.min(o,e+100663296),Le(Math.min(2147483648,((t=Math.max(e,o))%(r=65536)>0&&(t+=r-t%r),t))))return!0}return!1},exit:We,memory:A,setTempRet0:Oe,tree_sitter_log_callback:function(e,t){if(ct){const r=j(t);ct(r,0!==e)}},tree_sitter_parse_callback:function(e,t,r,n,s){var o=dt(t,{row:r,column:n});"string"==typeof o?(x(s,o.length,"i32"),function(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=o,t+=2}L[t>>1]=0}(o,e,10240)):x(s,0,"i32")}},$e=(function(){var e={env:Fe,wasi_snapshot_preview1:Fe,"GOT.mem":new Proxy(Fe,fe),"GOT.func":new Proxy(Fe,fe)};function t(e,t){var r=e.exports;r=Ae(r,1024),Module.asm=r;var n,s=he(t);s.neededDynlibs&&(I=s.neededDynlibs.concat(I)),Me(r),n=Module.asm.__wasm_call_ctors,X.unshift(n),se()}function r(e){t(e.instance,e.module)}function n(t){return function(){if(!v&&(i||l)){if("function"==typeof fetch&&!de(_e))return fetch(_e,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+_e+"'";return e.arrayBuffer()}).catch(function(){return ce(_e)});if(c)return new Promise(function(e,t){c(_e,function(t){e(new Uint8Array(t))},t)})}return Promise.resolve().then(function(){return ce(_e)})}().then(function(t){return WebAssembly.instantiate(t,e)}).then(t,function(e){g("failed to asynchronously prepare wasm: "+e),oe(e)})}if(ne(),Module.instantiateWasm)try{return Module.instantiateWasm(e,t)}catch(e){return g("Module.instantiateWasm callback failed with error: "+e),!1}v||"function"!=typeof WebAssembly.instantiateStreaming||le(_e)||de(_e)||"function"!=typeof fetch?n(r):fetch(_e,{credentials:"same-origin"}).then(function(t){return WebAssembly.instantiateStreaming(t,e).then(r,function(e){return g("wasm streaming compile failed: "+e),g("falling back to ArrayBuffer instantiation"),n(r)})})}(),Module.___wasm_call_ctors=function(){return(Module.___wasm_call_ctors=Module.asm.__wasm_call_ctors).apply(null,arguments)},Module._malloc=function(){return($e=Module._malloc=Module.asm.malloc).apply(null,arguments)}),je=(Module._calloc=function(){return(Module._calloc=Module.asm.calloc).apply(null,arguments)},Module._realloc=function(){return(Module._realloc=Module.asm.realloc).apply(null,arguments)},Module._free=function(){return(Module._free=Module.asm.free).apply(null,arguments)},Module._ts_language_symbol_count=function(){return(Module._ts_language_symbol_count=Module.asm.ts_language_symbol_count).apply(null,arguments)},Module._ts_language_version=function(){return(Module._ts_language_version=Module.asm.ts_language_version).apply(null,arguments)},Module._ts_language_field_count=function(){return(Module._ts_language_field_count=Module.asm.ts_language_field_count).apply(null,arguments)},Module._ts_language_symbol_name=function(){return(Module._ts_language_symbol_name=Module.asm.ts_language_symbol_name).apply(null,arguments)},Module._ts_language_symbol_for_name=function(){return(Module._ts_language_symbol_for_name=Module.asm.ts_language_symbol_for_name).apply(null,arguments)},Module._ts_language_symbol_type=function(){return(Module._ts_language_symbol_type=Module.asm.ts_language_symbol_type).apply(null,arguments)},Module._ts_language_field_name_for_id=function(){return(Module._ts_language_field_name_for_id=Module.asm.ts_language_field_name_for_id).apply(null,arguments)},Module._memcpy=function(){return(Module._memcpy=Module.asm.memcpy).apply(null,arguments)},Module._ts_parser_delete=function(){return(Module._ts_parser_delete=Module.asm.ts_parser_delete).apply(null,arguments)},Module._ts_parser_reset=function(){return(Module._ts_parser_reset=Module.asm.ts_parser_reset).apply(null,arguments)},Module._ts_parser_set_language=function(){return(Module._ts_parser_set_language=Module.asm.ts_parser_set_language).apply(null,arguments)},Module._ts_parser_timeout_micros=function(){return(Module._ts_parser_timeout_micros=Module.asm.ts_parser_timeout_micros).apply(null,arguments)},Module._ts_parser_set_timeout_micros=function(){return(Module._ts_parser_set_timeout_micros=Module.asm.ts_parser_set_timeout_micros).apply(null,arguments)},Module._memmove=function(){return(Module._memmove=Module.asm.memmove).apply(null,arguments)},Module._memcmp=function(){return(Module._memcmp=Module.asm.memcmp).apply(null,arguments)},Module._ts_query_new=function(){return(Module._ts_query_new=Module.asm.ts_query_new).apply(null,arguments)},Module._ts_query_delete=function(){return(Module._ts_query_delete=Module.asm.ts_query_delete).apply(null,arguments)},Module._iswspace=function(){return(Module._iswspace=Module.asm.iswspace).apply(null,arguments)},Module._iswalnum=function(){return(Module._iswalnum=Module.asm.iswalnum).apply(null,arguments)},Module._ts_query_pattern_count=function(){return(Module._ts_query_pattern_count=Module.asm.ts_query_pattern_count).apply(null,arguments)},Module._ts_query_capture_count=function(){return(Module._ts_query_capture_count=Module.asm.ts_query_capture_count).apply(null,arguments)},Module._ts_query_string_count=function(){return(Module._ts_query_string_count=Module.asm.ts_query_string_count).apply(null,arguments)},Module._ts_query_capture_name_for_id=function(){return(Module._ts_query_capture_name_for_id=Module.asm.ts_query_capture_name_for_id).apply(null,arguments)},Module._ts_query_string_value_for_id=function(){return(Module._ts_query_string_value_for_id=Module.asm.ts_query_string_value_for_id).apply(null,arguments)},Module._ts_query_predicates_for_pattern=function(){return(Module._ts_query_predicates_for_pattern=Module.asm.ts_query_predicates_for_pattern).apply(null,arguments)},Module._ts_tree_copy=function(){return(Module._ts_tree_copy=Module.asm.ts_tree_copy).apply(null,arguments)},Module._ts_tree_delete=function(){return(Module._ts_tree_delete=Module.asm.ts_tree_delete).apply(null,arguments)},Module._ts_init=function(){return(Module._ts_init=Module.asm.ts_init).apply(null,arguments)},Module._ts_parser_new_wasm=function(){return(Module._ts_parser_new_wasm=Module.asm.ts_parser_new_wasm).apply(null,arguments)},Module._ts_parser_enable_logger_wasm=function(){return(Module._ts_parser_enable_logger_wasm=Module.asm.ts_parser_enable_logger_wasm).apply(null,arguments)},Module._ts_parser_parse_wasm=function(){return(Module._ts_parser_parse_wasm=Module.asm.ts_parser_parse_wasm).apply(null,arguments)},Module._ts_language_type_is_named_wasm=function(){return(Module._ts_language_type_is_named_wasm=Module.asm.ts_language_type_is_named_wasm).apply(null,arguments)},Module._ts_language_type_is_visible_wasm=function(){return(Module._ts_language_type_is_visible_wasm=Module.asm.ts_language_type_is_visible_wasm).apply(null,arguments)},Module._ts_tree_root_node_wasm=function(){return(Module._ts_tree_root_node_wasm=Module.asm.ts_tree_root_node_wasm).apply(null,arguments)},Module._ts_tree_edit_wasm=function(){return(Module._ts_tree_edit_wasm=Module.asm.ts_tree_edit_wasm).apply(null,arguments)},Module._ts_tree_get_changed_ranges_wasm=function(){return(Module._ts_tree_get_changed_ranges_wasm=Module.asm.ts_tree_get_changed_ranges_wasm).apply(null,arguments)},Module._ts_tree_cursor_new_wasm=function(){return(Module._ts_tree_cursor_new_wasm=Module.asm.ts_tree_cursor_new_wasm).apply(null,arguments)},Module._ts_tree_cursor_delete_wasm=function(){return(Module._ts_tree_cursor_delete_wasm=Module.asm.ts_tree_cursor_delete_wasm).apply(null,arguments)},Module._ts_tree_cursor_reset_wasm=function(){return(Module._ts_tree_cursor_reset_wasm=Module.asm.ts_tree_cursor_reset_wasm).apply(null,arguments)},Module._ts_tree_cursor_goto_first_child_wasm=function(){return(Module._ts_tree_cursor_goto_first_child_wasm=Module.asm.ts_tree_cursor_goto_first_child_wasm).apply(null,arguments)},Module._ts_tree_cursor_goto_next_sibling_wasm=function(){return(Module._ts_tree_cursor_goto_next_sibling_wasm=Module.asm.ts_tree_cursor_goto_next_sibling_wasm).apply(null,arguments)},Module._ts_tree_cursor_goto_parent_wasm=function(){return(Module._ts_tree_cursor_goto_parent_wasm=Module.asm.ts_tree_cursor_goto_parent_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_type_id_wasm=function(){return(Module._ts_tree_cursor_current_node_type_id_wasm=Module.asm.ts_tree_cursor_current_node_type_id_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_is_named_wasm=function(){return(Module._ts_tree_cursor_current_node_is_named_wasm=Module.asm.ts_tree_cursor_current_node_is_named_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_is_missing_wasm=function(){return(Module._ts_tree_cursor_current_node_is_missing_wasm=Module.asm.ts_tree_cursor_current_node_is_missing_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_id_wasm=function(){return(Module._ts_tree_cursor_current_node_id_wasm=Module.asm.ts_tree_cursor_current_node_id_wasm).apply(null,arguments)},Module._ts_tree_cursor_start_position_wasm=function(){return(Module._ts_tree_cursor_start_position_wasm=Module.asm.ts_tree_cursor_start_position_wasm).apply(null,arguments)},Module._ts_tree_cursor_end_position_wasm=function(){return(Module._ts_tree_cursor_end_position_wasm=Module.asm.ts_tree_cursor_end_position_wasm).apply(null,arguments)},Module._ts_tree_cursor_start_index_wasm=function(){return(Module._ts_tree_cursor_start_index_wasm=Module.asm.ts_tree_cursor_start_index_wasm).apply(null,arguments)},Module._ts_tree_cursor_end_index_wasm=function(){return(Module._ts_tree_cursor_end_index_wasm=Module.asm.ts_tree_cursor_end_index_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_field_id_wasm=function(){return(Module._ts_tree_cursor_current_field_id_wasm=Module.asm.ts_tree_cursor_current_field_id_wasm).apply(null,arguments)},Module._ts_tree_cursor_current_node_wasm=function(){return(Module._ts_tree_cursor_current_node_wasm=Module.asm.ts_tree_cursor_current_node_wasm).apply(null,arguments)},Module._ts_node_symbol_wasm=function(){return(Module._ts_node_symbol_wasm=Module.asm.ts_node_symbol_wasm).apply(null,arguments)},Module._ts_node_child_count_wasm=function(){return(Module._ts_node_child_count_wasm=Module.asm.ts_node_child_count_wasm).apply(null,arguments)},Module._ts_node_named_child_count_wasm=function(){return(Module._ts_node_named_child_count_wasm=Module.asm.ts_node_named_child_count_wasm).apply(null,arguments)},Module._ts_node_child_wasm=function(){return(Module._ts_node_child_wasm=Module.asm.ts_node_child_wasm).apply(null,arguments)},Module._ts_node_named_child_wasm=function(){return(Module._ts_node_named_child_wasm=Module.asm.ts_node_named_child_wasm).apply(null,arguments)},Module._ts_node_child_by_field_id_wasm=function(){return(Module._ts_node_child_by_field_id_wasm=Module.asm.ts_node_child_by_field_id_wasm).apply(null,arguments)},Module._ts_node_next_sibling_wasm=function(){return(Module._ts_node_next_sibling_wasm=Module.asm.ts_node_next_sibling_wasm).apply(null,arguments)},Module._ts_node_prev_sibling_wasm=function(){return(Module._ts_node_prev_sibling_wasm=Module.asm.ts_node_prev_sibling_wasm).apply(null,arguments)},Module._ts_node_next_named_sibling_wasm=function(){return(Module._ts_node_next_named_sibling_wasm=Module.asm.ts_node_next_named_sibling_wasm).apply(null,arguments)},Module._ts_node_prev_named_sibling_wasm=function(){return(Module._ts_node_prev_named_sibling_wasm=Module.asm.ts_node_prev_named_sibling_wasm).apply(null,arguments)},Module._ts_node_parent_wasm=function(){return(Module._ts_node_parent_wasm=Module.asm.ts_node_parent_wasm).apply(null,arguments)},Module._ts_node_descendant_for_index_wasm=function(){return(Module._ts_node_descendant_for_index_wasm=Module.asm.ts_node_descendant_for_index_wasm).apply(null,arguments)},Module._ts_node_named_descendant_for_index_wasm=function(){return(Module._ts_node_named_descendant_for_index_wasm=Module.asm.ts_node_named_descendant_for_index_wasm).apply(null,arguments)},Module._ts_node_descendant_for_position_wasm=function(){return(Module._ts_node_descendant_for_position_wasm=Module.asm.ts_node_descendant_for_position_wasm).apply(null,arguments)},Module._ts_node_named_descendant_for_position_wasm=function(){return(Module._ts_node_named_descendant_for_position_wasm=Module.asm.ts_node_named_descendant_for_position_wasm).apply(null,arguments)},Module._ts_node_start_point_wasm=function(){return(Module._ts_node_start_point_wasm=Module.asm.ts_node_start_point_wasm).apply(null,arguments)},Module._ts_node_end_point_wasm=function(){return(Module._ts_node_end_point_wasm=Module.asm.ts_node_end_point_wasm).apply(null,arguments)},Module._ts_node_start_index_wasm=function(){return(Module._ts_node_start_index_wasm=Module.asm.ts_node_start_index_wasm).apply(null,arguments)},Module._ts_node_end_index_wasm=function(){return(Module._ts_node_end_index_wasm=Module.asm.ts_node_end_index_wasm).apply(null,arguments)},Module._ts_node_to_string_wasm=function(){return(Module._ts_node_to_string_wasm=Module.asm.ts_node_to_string_wasm).apply(null,arguments)},Module._ts_node_children_wasm=function(){return(Module._ts_node_children_wasm=Module.asm.ts_node_children_wasm).apply(null,arguments)},Module._ts_node_named_children_wasm=function(){return(Module._ts_node_named_children_wasm=Module.asm.ts_node_named_children_wasm).apply(null,arguments)},Module._ts_node_descendants_of_type_wasm=function(){return(Module._ts_node_descendants_of_type_wasm=Module.asm.ts_node_descendants_of_type_wasm).apply(null,arguments)},Module._ts_node_is_named_wasm=function(){return(Module._ts_node_is_named_wasm=Module.asm.ts_node_is_named_wasm).apply(null,arguments)},Module._ts_node_has_changes_wasm=function(){return(Module._ts_node_has_changes_wasm=Module.asm.ts_node_has_changes_wasm).apply(null,arguments)},Module._ts_node_has_error_wasm=function(){return(Module._ts_node_has_error_wasm=Module.asm.ts_node_has_error_wasm).apply(null,arguments)},Module._ts_node_is_missing_wasm=function(){return(Module._ts_node_is_missing_wasm=Module.asm.ts_node_is_missing_wasm).apply(null,arguments)},Module._ts_query_matches_wasm=function(){return(Module._ts_query_matches_wasm=Module.asm.ts_query_matches_wasm).apply(null,arguments)},Module._ts_query_captures_wasm=function(){return(Module._ts_query_captures_wasm=Module.asm.ts_query_captures_wasm).apply(null,arguments)},Module._iswdigit=function(){return(Module._iswdigit=Module.asm.iswdigit).apply(null,arguments)},Module._iswalpha=function(){return(Module._iswalpha=Module.asm.iswalpha).apply(null,arguments)},Module._iswlower=function(){return(Module._iswlower=Module.asm.iswlower).apply(null,arguments)},Module._towupper=function(){return(Module._towupper=Module.asm.towupper).apply(null,arguments)},Module.___errno_location=function(){return(je=Module.___errno_location=Module.asm.__errno_location).apply(null,arguments)}),Ue=(Module._memchr=function(){return(Module._memchr=Module.asm.memchr).apply(null,arguments)},Module._strlen=function(){return(Module._strlen=Module.asm.strlen).apply(null,arguments)},Module.stackSave=function(){return(Ue=Module.stackSave=Module.asm.stackSave).apply(null,arguments)}),De=Module.stackRestore=function(){return(De=Module.stackRestore=Module.asm.stackRestore).apply(null,arguments)},ze=Module.stackAlloc=function(){return(ze=Module.stackAlloc=Module.asm.stackAlloc).apply(null,arguments)},Ge=Module._setThrew=function(){return(Ge=Module._setThrew=Module.asm.setThrew).apply(null,arguments)};Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm).apply(null,arguments)},Module.__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=function(){return(Module.__ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm=Module.asm._ZNKSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4copyEPcmm).apply(null,arguments)},Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=function(){return(Module.__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc=Module.asm._ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc).apply(null,arguments)},Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=function(){return(Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev=Module.asm._ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED2Ev).apply(null,arguments)},Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=function(){return(Module.__ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw=Module.asm._ZNSt3__212basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE9push_backEw).apply(null,arguments)},Module.__Znwm=function(){return(Module.__Znwm=Module.asm._Znwm).apply(null,arguments)},Module.__ZdlPv=function(){return(Module.__ZdlPv=Module.asm._ZdlPv).apply(null,arguments)},Module.__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv=function(){return(Module.__ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv=Module.asm._ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv).apply(null,arguments)},Module._orig$ts_parser_timeout_micros=function(){return(Module._orig$ts_parser_timeout_micros=Module.asm.orig$ts_parser_timeout_micros).apply(null,arguments)},Module._orig$ts_parser_set_timeout_micros=function(){return(Module._orig$ts_parser_set_timeout_micros=Module.asm.orig$ts_parser_set_timeout_micros).apply(null,arguments)};function He(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}Module.allocate=function(e,t){var r;return r=t==C?ze(e.length):$e(e.length),e.subarray||e.slice?T.set(e,r):T.set(new Uint8Array(e),r),r};re=function e(){Ze||Ke(),Ze||(re=e)};var Be=!1;function Ke(e){function t(){Ze||(Ze=!0,Module.calledRun=!0,P||(Y=!0,pe(X),pe(Q),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Xe&&function(e){var t=Module._main;if(t){var r=(e=e||[]).length+1,n=ze(4*(r+1));W[n>>2]=G(a);for(var s=1;s>2)+s]=G(e[s-1]);W[(n>>2)+r]=0;try{Ve(t(r,n),!0)}catch(e){if(e instanceof He)return;if("unwind"==e)return;var o=e;e&&"object"==typeof e&&e.stack&&(o=[e,e.stack]),g("exception thrown: "+o),u(1,e)}finally{!0}}}(e),function(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)e=Module.postRun.shift(),J.unshift(e);var e;pe(J)}()))}e=e||_,ee>0||!Be&&(function(){if(I.length){if(!m)return ne(),void I.reduce(function(e,t){return e.then(function(){return Ne(t,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})})},Promise.resolve()).then(function(){se(),Pe()});I.forEach(function(e){Ne(e,{global:!0,nodelete:!0,allowUndefined:!0})}),Pe()}else Pe()}(),Be=!0,ee>0)||(!function(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)e=Module.preRun.shift(),V.unshift(e);var e;pe(V)}(),ee>0||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),t()},1)):t()))}function Ve(e,t){e,t&&we()&&0===e||(we()||(!0,Module.onExit&&Module.onExit(e),P=!0),u(e,new He(e)))}if(Module.run=Ke,Module.preInit)for("function"==typeof Module.preInit&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var Xe=!0;Module.noInitialRun&&(Xe=!1),Ke();const Qe=Module,Je={},Ye=4,et=5*Ye,tt=2*Ye,rt=2*Ye+2*tt,nt={row:0,column:0},st=/[\w-.]*/g,ot=1,_t=2,at=/^_?tree_sitter_\w+/;var ut,it,lt,dt,ct;class ParserImpl{static init(){lt=Qe._ts_init(),ut=N(lt,"i32"),it=N(lt+Ye,"i32")}initialize(){Qe._ts_parser_new_wasm(),this[0]=N(lt,"i32"),this[1]=N(lt+Ye,"i32")}delete(){Qe._ts_parser_delete(this[0]),Qe._free(this[1]),this[0]=0,this[1]=0}setLanguage(e){let t;if(e){if(e.constructor!==Language)throw new Error("Argument must be a Language");{t=e[0];const r=Qe._ts_language_version(t);if(re.slice(t,n));else{if("function"!=typeof e)throw new Error("Argument must be a string or a function");dt=e}this.logCallback?(ct=this.logCallback,Qe._ts_parser_enable_logger_wasm(this[0],1)):(ct=null,Qe._ts_parser_enable_logger_wasm(this[0],0));let n=0,s=0;if(r&&r.includedRanges){n=r.includedRanges.length;let e=s=Qe._calloc(n,rt);for(let t=0;t0){let e=r;for(let r=0;r0){let r=t;for(let t=0;t0){let r=t;for(let t=0;t0){let e=a;for(let t=0;t<_;t++)u[t]=wt(this.tree,e),e+=et}return Qe._free(a),Qe._free(o),u}get nextSibling(){return gt(this),Qe._ts_node_next_sibling_wasm(this.tree[0]),wt(this.tree)}get previousSibling(){return gt(this),Qe._ts_node_prev_sibling_wasm(this.tree[0]),wt(this.tree)}get nextNamedSibling(){return gt(this),Qe._ts_node_next_named_sibling_wasm(this.tree[0]),wt(this.tree)}get previousNamedSibling(){return gt(this),Qe._ts_node_prev_named_sibling_wasm(this.tree[0]),wt(this.tree)}get parent(){return gt(this),Qe._ts_node_parent_wasm(this.tree[0]),wt(this.tree)}descendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");gt(this);let r=lt+et;return x(r,e,"i32"),x(r+Ye,t,"i32"),Qe._ts_node_descendant_for_index_wasm(this.tree[0]),wt(this.tree)}namedDescendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");gt(this);let r=lt+et;return x(r,e,"i32"),x(r+Ye,t,"i32"),Qe._ts_node_named_descendant_for_index_wasm(this.tree[0]),wt(this.tree)}descendantForPosition(e,t=e){if(!ht(e)||!ht(t))throw new Error("Arguments must be {row, column} objects");gt(this);let r=lt+et;return bt(r,e),bt(r+tt,t),Qe._ts_node_descendant_for_position_wasm(this.tree[0]),wt(this.tree)}namedDescendantForPosition(e,t=e){if(!ht(e)||!ht(t))throw new Error("Arguments must be {row, column} objects");gt(this);let r=lt+et;return bt(r,e),bt(r+tt,t),Qe._ts_node_named_descendant_for_position_wasm(this.tree[0]),wt(this.tree)}walk(){return gt(this),Qe._ts_tree_cursor_new_wasm(this.tree[0]),new TreeCursor(Je,this.tree)}toString(){gt(this);const e=Qe._ts_node_to_string_wasm(this.tree[0]),t=function(e){for(var t="";;){var r=T[e++>>0];if(!r)return t;t+=String.fromCharCode(r)}}(e);return Qe._free(e),t}}class TreeCursor{constructor(e,t){pt(e),this.tree=t,Mt(this)}delete(){yt(this),Qe._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(e){gt(e),yt(this,lt+et),Qe._ts_tree_cursor_reset_wasm(this.tree[0]),Mt(this)}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return yt(this),Qe._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeId(){return yt(this),Qe._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return yt(this),1===Qe._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])}get nodeIsMissing(){return yt(this),1===Qe._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])}get nodeText(){yt(this);const e=Qe._ts_tree_cursor_start_index_wasm(this.tree[0]),t=Qe._ts_tree_cursor_end_index_wasm(this.tree[0]);return mt(this.tree,e,t)}get startPosition(){return yt(this),Qe._ts_tree_cursor_start_position_wasm(this.tree[0]),vt(lt)}get endPosition(){return yt(this),Qe._ts_tree_cursor_end_position_wasm(this.tree[0]),vt(lt)}get startIndex(){return yt(this),Qe._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return yt(this),Qe._ts_tree_cursor_end_index_wasm(this.tree[0])}currentNode(){return yt(this),Qe._ts_tree_cursor_current_node_wasm(this.tree[0]),wt(this.tree)}currentFieldId(){return yt(this),Qe._ts_tree_cursor_current_field_id_wasm(this.tree[0])}currentFieldName(){return this.tree.language.fields[this.currentFieldId()]}gotoFirstChild(){yt(this);const e=Qe._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return Mt(this),1===e}gotoNextSibling(){yt(this);const e=Qe._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return Mt(this),1===e}gotoParent(){yt(this);const e=Qe._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return Mt(this),1===e}}class Language{constructor(e,t){pt(e),this[0]=t,this.types=new Array(Qe._ts_language_symbol_count(this[0]));for(let e=0,t=this.types.length;e0){if("string"!==s[0].type)throw new Error("Predicates must begin with a literal value");const t=s[0].value;let r=!0;switch(t){case"not-eq?":r=!1;case"eq?":if(3!==s.length)throw new Error(`Wrong number of arguments to \`#eq?\` predicate. Expected 2, got ${s.length-1}`);if("capture"!==s[1].type)throw new Error(`First argument of \`#eq?\` predicate must be a capture. Got "${s[1].value}"`);if("capture"===s[2].type){const t=s[1].name,n=s[2].name;m[e].push(function(e){let s,o;for(const r of e)r.name===t&&(s=r.node),r.name===n&&(o=r.node);return void 0===s||void 0===o||s.text===o.text===r})}else{const t=s[1].name,n=s[2].value;m[e].push(function(e){for(const s of e)if(s.name===t)return s.node.text===n===r;return!0})}break;case"not-match?":r=!1;case"match?":if(3!==s.length)throw new Error(`Wrong number of arguments to \`#match?\` predicate. Expected 2, got ${s.length-1}.`);if("capture"!==s[1].type)throw new Error(`First argument of \`#match?\` predicate must be a capture. Got "${s[1].value}".`);if("string"!==s[2].type)throw new Error(`Second argument of \`#match?\` predicate must be a string. Got @${s[2].value}.`);const n=s[1].name,o=new RegExp(s[2].value);m[e].push(function(e){for(const t of e)if(t.name===n)return o.test(t.node.text)===r;return!0});break;case"set!":if(s.length<2||s.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${s.length-1}.`);if(s.some(e=>"string"!==e.type))throw new Error('Arguments to `#set!` predicate must be a strings.".');i[e]||(i[e]={}),i[e][s[1].value]=s[2]?s[2].value:null;break;case"is?":case"is-not?":if(s.length<2||s.length>3)throw new Error(`Wrong number of arguments to \`#${t}\` predicate. Expected 1 or 2. Got ${s.length-1}.`);if(s.some(e=>"string"!==e.type))throw new Error(`Arguments to \`#${t}\` predicate must be a strings.".`);const _="is?"===t?l:d;_[e]||(_[e]={}),_[e][s[1].value]=s[2]?s[2].value:null;break;default:c[e].push({operator:t,operands:s.slice(1)})}s.length=0}}Object.freeze(i[e]),Object.freeze(l[e]),Object.freeze(d[e])}return Qe._free(r),new Query(Je,n,a,m,c,Object.freeze(i),Object.freeze(l),Object.freeze(d))}static load(e){let t;if(e instanceof Uint8Array)t=Promise.resolve(e);else{const r=e;if("undefined"!=typeof process&&process.versions&&process.versions.node){const e=require("fs");t=Promise.resolve(e.readFileSync(r))}else t=fetch(r).then(e=>e.arrayBuffer().then(t=>{if(e.ok)return new Uint8Array(t);{const r=new TextDecoder("utf-8").decode(t);throw new Error(`Language.load failed with status ${e.status}.\n\n${r}`)}}))}const r="function"==typeof loadSideModule?loadSideModule:xe;return t.then(e=>r(e,{loadAsync:!0})).then(e=>{const t=Object.keys(e),r=t.find(e=>at.test(e)&&!e.includes("external_scanner_"));r||console.log(`Couldn't find language function in WASM file. Symbols:\n${JSON.stringify(t,null,2)}`);const n=e[r]();return new Language(Je,n)})}}class Query{constructor(e,t,r,n,s,o,_,a){pt(e),this[0]=t,this.captureNames=r,this.textPredicates=n,this.predicates=s,this.setProperties=o,this.assertedProperties=_,this.refutedProperties=a,this.exceededMatchLimit=!1}delete(){Qe._ts_query_delete(this[0]),this[0]=0}matches(e,t,r,n){t||(t=nt),r||(r=nt),n||(n={});let s=n.matchLimit;if(void 0===s)s=0;else if("number"!=typeof s)throw new Error("Arguments must be numbers");gt(e),Qe._ts_query_matches_wasm(this[0],e.tree[0],t.row,t.column,r.row,r.column,s);const o=N(lt,"i32"),_=N(lt+Ye,"i32"),a=N(lt+2*Ye,"i32"),u=new Array(o);this.exceededMatchLimit=!!a;let i=0,l=_;for(let t=0;te(s))){u[i++]={pattern:r,captures:s};const e=this.setProperties[r];e&&(u[t].setProperties=e);const n=this.assertedProperties[r];n&&(u[t].assertedProperties=n);const o=this.refutedProperties[r];o&&(u[t].refutedProperties=o)}}return u.length=i,Qe._free(_),u}captures(e,t,r,n){t||(t=nt),r||(r=nt),n||(n={});let s=n.matchLimit;if(void 0===s)s=0;else if("number"!=typeof s)throw new Error("Arguments must be numbers");gt(e),Qe._ts_query_captures_wasm(this[0],e.tree[0],t.row,t.column,r.row,r.column,s);const o=N(lt,"i32"),_=N(lt+Ye,"i32"),a=N(lt+2*Ye,"i32"),u=[];this.exceededMatchLimit=!!a;const i=[];let l=_;for(let t=0;te(i))){const e=i[n],r=this.setProperties[t];r&&(e.setProperties=r);const s=this.assertedProperties[t];s&&(e.assertedProperties=s);const o=this.refutedProperties[t];o&&(e.refutedProperties=o),u.push(e)}}return Qe._free(_),u}predicatesForPattern(e){return this.predicates[e]}didExceedMatchLimit(){return this.exceededMatchLimit}}function mt(e,t,r){const n=r-t;let s=e.textCallback(t,null,r);for(t+=s.length;t0))break;t+=n.length,s+=n}return t>r&&(s=s.slice(0,n)),s}function ft(e,t,r,n){for(let s=0,o=n.length;s{ParserImpl.init(),e()})}))}}return Parser}();"object"==typeof exports&&(module.exports=TreeSitter); diff --git a/vendored_parsers/tree-sitter-hcl/docs/vendor/tree-sitter.wasm b/vendored_parsers/tree-sitter-hcl/docs/vendor/tree-sitter.wasm deleted file mode 100644 index 84ac0a2a0..000000000 Binary files a/vendored_parsers/tree-sitter-hcl/docs/vendor/tree-sitter.wasm and /dev/null differ diff --git a/vendored_parsers/tree-sitter-hcl/example/example.hcl b/vendored_parsers/tree-sitter-hcl/example/example.hcl deleted file mode 100644 index d5688aa78..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/example.hcl +++ /dev/null @@ -1,95 +0,0 @@ -resource "example" "literals" { - attr1 = "val1" - tupl1 = [ 1, 2, 3.4, "foo" ] - tupl2 = [] - obj1 = { foo = "bar", baz = quz } - null1 = null - bool1 = true - bool2 = false - esc1 = "\" \t \UFF11FF22 \uFFFF \n" - esc2 = "$${} %%{}" - num1 = 2 - num2 = 2.112 - num3 = 2.112e-12 - num4 = 2.112e+12 - num5 = 2.112E+12 - num6 = 2.112E-12 - num7 = 0x21FF -} - -resource "example" "comments" { - // comment - # comment - /* - comment - */ -} - -resource "example" "splat_expressions" { - splat1 = foo.*.bar.baz[0] - splat2 = foo[*].bar.baz[0] -} - -resource "example" "for_expressions" { - for1 = { for i, v in ["a", "a", "b"] : v => i... } - for2 = [ for k, v in x : "${k}-${v}" ] - for3 = { for k, v in x: k => v } - for4 = [ for v in x : v ] - for5 = { for v in x : v => v } - for6 = [ for v in x : v if v < 3 ] -} - -resource "example" "function_expressions" { - func1 = is_number("123") - func2 = multiline( - arg1, - arg2, - arg3... - ) - func3 = withobject({ - "foo" : 2, - "bar" : baz, - key : val, - fizz : buzz, - }) -} - -resource "example" "binary_expressions" { - cond1 = (1 == 2) ? 1 : "foobar" - bin1 = ((1+2)%3)*4 -} - -resource "example" "template_expressions" { - tpl1 = "prefix-${var.bar}" - tpl2 = "prefix-${func("bar")}" - tpl3 = "prefix-${func("nested-${var.bar}")}" - - tpl4 = < 0 ? - "${var.worker_azs[count.index]}" : - "${data.aws_availability_zones.azs.names[count.index]}" }", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "kubernetes.io/role/internal-elb", "", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -resource "aws_route_table_association" "worker_routing" { - count = "${var.external_vpc_id == "" ? var.worker_az_count : 0}" - route_table_id = "${aws_route_table.private_routes.*.id[count.index]}" - subnet_id = "${aws_subnet.worker_subnet.*.id[count.index]}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc-public.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc-public.tf deleted file mode 100644 index 8eb13ab4f..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc-public.tf +++ /dev/null @@ -1,74 +0,0 @@ -resource "aws_internet_gateway" "igw" { - count = "${local.external_vpc_mode ? 0 : 1}" - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - - tags = "${merge(map( - "Name", "${var.cluster_name}-igw", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -resource "aws_route_table" "default" { - count = "${var.external_vpc_id == "" ? 1 : 0}" - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - - tags = "${merge(map( - "Name", "${var.cluster_name}-public", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}", - ), var.extra_tags)}" -} - -resource "aws_main_route_table_association" "main_vpc_routes" { - count = "${local.external_vpc_mode ? 0 : 1}" - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - route_table_id = "${aws_route_table.default.id}" -} - -resource "aws_route" "igw_route" { - count = "${local.external_vpc_mode ? 0 : 1}" - destination_cidr_block = "0.0.0.0/0" - route_table_id = "${aws_route_table.default.id}" - gateway_id = "${aws_internet_gateway.igw.id}" -} - -resource "aws_subnet" "master_subnet" { - count = "${local.new_master_az_count}" - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - - cidr_block = "${lookup(var.new_master_subnet_configs, - local.new_master_subnet_azs[count.index], - cidrsubnet(local.new_master_cidr_range, 3, count.index), - )}" - - availability_zone = "${local.new_master_subnet_azs[count.index]}" - - tags = "${merge(map( - "Name", "${var.cluster_name}-master-${local.new_master_subnet_azs[count.index]}", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -resource "aws_route_table_association" "route_net" { - count = "${local.new_master_az_count}" - route_table_id = "${aws_route_table.default.id}" - subnet_id = "${aws_subnet.master_subnet.*.id[count.index]}" -} - -resource "aws_eip" "nat_eip" { - count = "${min(local.new_master_az_count,local.new_worker_az_count)}" - vpc = true - - # Terraform does not declare an explicit dependency towards the internet gateway. - # this can cause the internet gateway to be deleted/detached before the EIPs. - # https://github.com/coreos/tectonic-installer/issues/1017#issuecomment-307780549 - depends_on = ["aws_internet_gateway.igw"] -} - -resource "aws_nat_gateway" "nat_gw" { - count = "${min(local.new_master_az_count,local.new_worker_az_count)}" - allocation_id = "${aws_eip.nat_eip.*.id[count.index]}" - subnet_id = "${aws_subnet.master_subnet.*.id[count.index]}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc-public.tf-192 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc-public.tf-192 deleted file mode 100644 index 8f5c0d013..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc-public.tf-192 +++ /dev/null @@ -1,77 +0,0 @@ -resource "aws_internet_gateway" "igw" { - count = "${var.external_vpc_id == "" ? 1 : 0}" - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - - tags = "${merge(map( - "Name", "${var.cluster_name}-igw", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -resource "aws_route_table" "default" { - count = "${var.external_vpc_id == "" ? 1 : 0}" - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - - tags = "${merge(map( - "Name", "${var.cluster_name}-public", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -resource "aws_main_route_table_association" "main_vpc_routes" { - count = "${var.external_vpc_id == "" ? 1 : 0}" - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - route_table_id = "${aws_route_table.default.id}" -} - -resource "aws_route" "igw_route" { - count = "${var.external_vpc_id == "" ? 1 : 0}" - destination_cidr_block = "0.0.0.0/0" - route_table_id = "${aws_route_table.default.id}" - gateway_id = "${aws_internet_gateway.igw.id}" -} - -resource "aws_subnet" "master_subnet" { - count = "${var.external_vpc_id == "" ? var.master_az_count : 0}" - - vpc_id = "${data.aws_vpc.cluster_vpc.id}" - - cidr_block = "${length(var.master_subnets) > 1 ? - "${element(var.master_subnets, count.index)}" : - "${cidrsubnet(data.aws_vpc.cluster_vpc.cidr_block, 4, count.index)}" - }" - - availability_zone = "${var.master_azs[count.index]}" - - tags = "${merge(map( - "Name", "${var.cluster_name}-master-${ "${length(var.master_azs)}" > 0 ? - "${var.master_azs[count.index]}" : - "${data.aws_availability_zones.azs.names[count.index]}" }", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -resource "aws_route_table_association" "route_net" { - count = "${var.external_vpc_id == "" ? var.master_az_count : 0}" - route_table_id = "${aws_route_table.default.id}" - subnet_id = "${aws_subnet.master_subnet.*.id[count.index]}" -} - -resource "aws_eip" "nat_eip" { - count = "${var.external_vpc_id == "" ? min(var.master_az_count, var.worker_az_count) : 0}" - vpc = true - - # Terraform does not declare an explicit dependency towards the internet gateway. - # this can cause the internet gateway to be deleted/detached before the EIPs. - # https://github.com/coreos/tectonic-installer/issues/1017#issuecomment-307780549 - depends_on = ["aws_internet_gateway.igw"] -} - -resource "aws_nat_gateway" "nat_gw" { - count = "${var.external_vpc_id == "" ? min(var.master_az_count, var.worker_az_count) : 0}" - allocation_id = "${aws_eip.nat_eip.*.id[count.index]}" - subnet_id = "${aws_subnet.master_subnet.*.id[count.index]}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc.tf deleted file mode 100644 index 7f112e365..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc.tf +++ /dev/null @@ -1,17 +0,0 @@ -locals { - new_worker_cidr_range = "${cidrsubnet(data.aws_vpc.cluster_vpc.cidr_block,1,1)}" - new_master_cidr_range = "${cidrsubnet(data.aws_vpc.cluster_vpc.cidr_block,1,0)}" -} - -resource "aws_vpc" "new_vpc" { - count = "${var.external_vpc_id == "" ? 1 : 0}" - cidr_block = "${var.cidr_block}" - enable_dns_hostnames = true - enable_dns_support = true - - tags = "${merge(map( - "Name", "${var.cluster_name}.${var.base_domain}", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc.tf-244 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc.tf-244 deleted file mode 100644 index 425a5db11..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%vpc%vpc.tf-244 +++ /dev/null @@ -1,30 +0,0 @@ -data "aws_availability_zones" "azs" {} - -resource "aws_vpc" "new_vpc" { - count = "${var.external_vpc_id == "" ? 1 : 0}" - cidr_block = "${var.cidr_block}" - enable_dns_hostnames = true - enable_dns_support = true - - tags = "${merge(map( - "Name", "${var.cluster_name}.${var.base_domain}", - "kubernetes.io/cluster/${var.cluster_name}", "shared", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -data "aws_vpc" "cluster_vpc" { - # The join() hack is required because currently the ternary operator - # evaluates the expressions on both branches of the condition before - # returning a value. When providing and external VPC, the template VPC - # resource gets a count of zero which triggers an evaluation error. - # - # This is tracked upstream: https://github.com/hashicorp/hil/issues/50 - # - id = "${var.external_vpc_id == "" ? join(" ", aws_vpc.new_vpc.*.id) : var.external_vpc_id }" -} - -locals { - master_subnet_ids = ["${split(",", var.external_vpc_id == "" ? join(",", aws_subnet.master_subnet.*.id) : join(",", data.aws_subnet.external_master.*.id))}"] - worker_subnet_ids = ["${split(",", var.external_vpc_id == "" ? join(",", aws_subnet.worker_subnet.*.id) : join(",", data.aws_subnet.external_worker.*.id))}"] -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%ignition.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%ignition.tf deleted file mode 100644 index aa405b29a..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%ignition.tf +++ /dev/null @@ -1,23 +0,0 @@ -data "ignition_config" "main" { - files = ["${compact(list( - var.ign_installer_kubelet_env_id, - var.ign_installer_runtime_mappings_id, - var.ign_max_user_watches_id, - var.ign_nfs_config_id, - var.ign_ntp_dropin_id, - var.ign_profile_env_id, - var.ign_s3_puller_id, - var.ign_systemd_default_env_id, - ))}", - "${var.ign_ca_cert_id_list}", - ] - - systemd = [ - "${var.ign_docker_dropin_id}", - "${var.ign_iscsi_service_id}", - "${var.ign_k8s_node_bootstrap_service_id}", - "${var.ign_kubelet_service_id}", - "${var.ign_locksmithd_service_id}", - "${var.ign_update_ca_certificates_dropin_id}", - ] -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%ignition_s3.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%ignition_s3.tf deleted file mode 100644 index 9766c6ba5..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%ignition_s3.tf +++ /dev/null @@ -1,21 +0,0 @@ -resource "aws_s3_bucket_object" "ignition_worker" { - bucket = "${var.s3_bucket}" - key = "ignition_worker.json" - content = "${data.ignition_config.main.rendered}" - acl = "private" - - server_side_encryption = "AES256" - - tags = "${merge(map( - "Name", "${var.cluster_name}-ignition-worker", - "KubernetesCluster", "${var.cluster_name}", - "tectonicClusterID", "${var.cluster_id}" - ), var.extra_tags)}" -} - -data "ignition_config" "s3" { - replace { - source = "${format("s3://%s/%s", var.s3_bucket, aws_s3_bucket_object.ignition_worker.key)}" - verification = "sha512-${sha512(data.ignition_config.main.rendered)}" - } -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%variables.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%variables.tf deleted file mode 100644 index 9ef407673..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%variables.tf +++ /dev/null @@ -1,95 +0,0 @@ -variable "ssh_key" { - type = "string" -} - -variable "container_linux_channel" { - type = "string" -} - -variable "container_linux_version" { - type = "string" -} - -variable "cluster_id" { - type = "string" -} - -variable "cluster_name" { - type = "string" -} - -variable "ec2_type" { - type = "string" -} - -variable "ec2_ami" { - type = "string" - default = "" -} - -variable "instance_count" { - type = "string" -} - -variable "subnet_ids" { - type = "list" -} - -variable "sg_ids" { - type = "list" - description = "The security group IDs to be applied." -} - -variable "load_balancers" { - description = "List of ELBs to attach all worker instances to." - type = "list" - default = [] -} - -variable "extra_tags" { - description = "Extra AWS tags to be applied to created resources." - type = "map" - default = {} -} - -variable "autoscaling_group_extra_tags" { - description = "Extra AWS tags to be applied to created autoscaling group resources." - type = "list" - default = [] -} - -variable "root_volume_type" { - type = "string" - description = "The type of volume for the root block device." -} - -variable "root_volume_size" { - type = "string" - description = "The size of the volume in gigabytes for the root block device." -} - -variable "root_volume_iops" { - type = "string" - default = "100" - description = "The amount of provisioned IOPS for the root block device." -} - -variable "worker_iam_role" { - type = "string" - default = "" - description = "IAM role to use for the instance profiles of worker nodes." -} - -variable "base_domain" { - type = "string" - description = "Domain on which the ELB records will be created" -} - -variable "kubeconfig_content" { - type = "string" - default = "" -} - -variable "user_data_ign" { - type = "string" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%variables.tf-199 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%variables.tf-199 deleted file mode 100644 index 8863e4d48..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%variables.tf-199 +++ /dev/null @@ -1,93 +0,0 @@ -variable "ssh_key" { - type = "string" -} - -variable "vpc_id" { - type = "string" -} - -variable "container_linux_channel" { - type = "string" -} - -variable "container_linux_version" { - type = "string" -} - -variable "cluster_id" { - type = "string" -} - -variable "cluster_name" { - type = "string" -} - -variable "ec2_type" { - type = "string" -} - -variable "ec2_ami" { - type = "string" - default = "" -} - -variable "instance_count" { - type = "string" -} - -variable "subnet_ids" { - type = "list" -} - -variable "sg_ids" { - type = "list" - description = "The security group IDs to be applied." -} - -variable "load_balancers" { - description = "List of ELBs to attach all worker instances to." - type = "list" - default = [] -} - -variable "extra_tags" { - description = "Extra AWS tags to be applied to created resources." - type = "map" - default = {} -} - -variable "autoscaling_group_extra_tags" { - description = "Extra AWS tags to be applied to created autoscaling group resources." - type = "list" - default = [] -} - -variable "root_volume_type" { - type = "string" - description = "The type of volume for the root block device." -} - -variable "root_volume_size" { - type = "string" - description = "The size of the volume in gigabytes for the root block device." -} - -variable "root_volume_iops" { - type = "string" - default = "100" - description = "The amount of provisioned IOPS for the root block device." -} - -variable "worker_iam_role" { - type = "string" - default = "" - description = "IAM role to use for the instance profiles of worker nodes." -} - -variable "ign_s3_puller_id" { - type = "string" -} - -variable "s3_bucket" { - type = "string" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%worker.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%worker.tf deleted file mode 100644 index fa9540db5..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%aws%worker-asg%worker.tf +++ /dev/null @@ -1,175 +0,0 @@ -locals { - ami_owner = "595879546273" - arn = "aws" -} - -data "aws_ami" "coreos_ami" { - filter { - name = "name" - values = ["CoreOS-${var.container_linux_channel}-${var.container_linux_version}-*"] - } - - filter { - name = "architecture" - values = ["x86_64"] - } - - filter { - name = "virtualization-type" - values = ["hvm"] - } - - filter { - name = "owner-id" - values = ["${local.ami_owner}"] - } -} - -resource "aws_launch_configuration" "worker_conf" { - instance_type = "${var.ec2_type}" - image_id = "${coalesce(var.ec2_ami, data.aws_ami.coreos_ami.image_id)}" - name_prefix = "${var.cluster_name}-worker-" - key_name = "${var.ssh_key}" - security_groups = ["${var.sg_ids}"] - iam_instance_profile = "${aws_iam_instance_profile.worker_profile.arn}" - user_data = "${var.user_data_ign}" - - lifecycle { - create_before_destroy = true - - # Ignore changes in the AMI which force recreation of the resource. This - # avoids accidental deletion of nodes whenever a new CoreOS Release comes - # out. - ignore_changes = ["image_id"] - } - - root_block_device { - volume_type = "${var.root_volume_type}" - volume_size = "${var.root_volume_size}" - iops = "${var.root_volume_type == "io1" ? var.root_volume_iops : 0}" - } -} - -resource "aws_autoscaling_group" "workers" { - name = "${var.cluster_name}-workers" - desired_capacity = "${var.instance_count}" - max_size = "${var.instance_count * 3}" - min_size = "${var.instance_count}" - launch_configuration = "${aws_launch_configuration.worker_conf.id}" - vpc_zone_identifier = ["${var.subnet_ids}"] - - tags = [ - { - key = "Name" - value = "${var.cluster_name}-worker" - propagate_at_launch = true - }, - { - key = "kubernetes.io/cluster/${var.cluster_name}" - value = "owned" - propagate_at_launch = true - }, - { - key = "tectonicClusterID" - value = "${var.cluster_id}" - propagate_at_launch = true - }, - "${var.autoscaling_group_extra_tags}", - ] - - lifecycle { - create_before_destroy = true - } -} - -resource "aws_autoscaling_attachment" "workers" { - count = "${length(var.load_balancers)}" - - autoscaling_group_name = "${aws_autoscaling_group.workers.name}" - elb = "${var.load_balancers[count.index]}" -} - -resource "aws_iam_instance_profile" "worker_profile" { - name = "${var.cluster_name}-worker-profile" - - role = "${var.worker_iam_role == "" ? - join("|", aws_iam_role.worker_role.*.name) : - join("|", data.aws_iam_role.worker_role.*.name) - }" -} - -data "aws_iam_role" "worker_role" { - count = "${var.worker_iam_role == "" ? 0 : 1}" - name = "${var.worker_iam_role}" -} - -resource "aws_iam_role" "worker_role" { - count = "${var.worker_iam_role == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-role" - path = "/" - - assume_role_policy = < 0 ? 1 : 0}" - name = "${var.cluster_name}-etcd-out" - description = "${var.cluster_name} etcd - Outbound" - priority = 2000 - direction = "Outbound" - access = "Allow" - protocol = "*" - source_port_range = "*" - destination_port_range = "*" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "*" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "etcd_ingress_ssh" { - count = "${var.external_nsg_master_id == "" && var.etcd_count > 0 ? 1 : 0}" - name = "${var.cluster_name}-etcd-in-ssh" - description = "${var.cluster_name} etcd - SSH" - priority = 400 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "22" - - # TODO: Reference subnet - source_address_prefix = "${var.ssh_network_internal}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "etcd_ingress_ssh_admin" { - count = "${var.external_nsg_master_id == "" && var.etcd_count > 0 ? 1 : 0}" - name = "${var.cluster_name}-etcd-in-ssh-external" - description = "${var.cluster_name} etcd - SSH external" - priority = 405 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "22" - - # TODO: Reference subnet - source_address_prefix = "${var.ssh_network_external}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "etcd_ingress_ssh_from_master" { - count = "${var.external_nsg_master_id == "" && var.etcd_count > 0 ? 1 : 0}" - name = "${var.cluster_name}-etcd-in-ssh-master" - description = "${var.cluster_name} etcd - SSH from master" - priority = 410 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "22" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "etcd_ingress_client_self" { - count = "${var.external_nsg_master_id == "" && var.etcd_count > 0 ? 1 : 0}" - name = "${var.cluster_name}-etcd-in-client-self" - description = "${var.cluster_name} etcd - etcd client" - priority = 415 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "2379" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "etcd_ingress_client_master" { - count = "${var.external_nsg_master_id == "" && var.etcd_count > 0 ? 1 : 0}" - name = "${var.cluster_name}-etcd-in-client-master" - description = "${var.cluster_name} etcd - etcd client from master" - priority = 420 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "2379" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "etcd_ingress_peer" { - count = "${var.external_nsg_master_id == "" && var.etcd_count > 0 ? 1 : 0}" - name = "${var.cluster_name}-etcd-in-peer" - description = "${var.cluster_name} etcd - etcd peer" - priority = 425 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "2380" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%nsg-master.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%nsg-master.tf deleted file mode 100644 index f224a7e83..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%nsg-master.tf +++ /dev/null @@ -1,242 +0,0 @@ -resource "azurerm_network_security_group" "master" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master" - location = "${var.location}" - resource_group_name = "${var.resource_group_name}" -} - -### LB rules -resource "azurerm_network_security_rule" "alb_probe" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-alb-probe" - description = "${var.cluster_name} master - Azure Load Balancer probe" - priority = 295 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "*" - source_address_prefix = "AzureLoadBalancer" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -# TODO: Fix NSG name and source -resource "azurerm_network_security_rule" "api_ingress_https" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-api-in-https" - description = "${var.cluster_name} Kubernetes API" - priority = 300 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "443" - - # TODO: Ternary on private implementation - source_address_prefix = "*" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "console_ingress_https" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-console-in-https" - description = "${var.cluster_name} Azure Load Balancer - Tectonic Console" - priority = 305 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "443" - - # TODO: Ternary on private implementation - source_address_prefix = "*" - destination_address_prefix = "AzureLoadBalancer" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "console_ingress_http" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-console-in-http" - description = "${var.cluster_name} Azure Load Balancer - Tectonic Identity" - priority = 310 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "80" - - # TODO: Ternary on private implementation - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "AzureLoadBalancer" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -### Master node rules - -resource "azurerm_network_security_rule" "master_egress" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-out" - description = "${var.cluster_name} master - Outbound" - priority = 2005 - direction = "Outbound" - access = "Allow" - protocol = "*" - source_port_range = "*" - destination_port_range = "*" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "*" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "master_ingress_ssh" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-ssh" - description = "${var.cluster_name} master - SSH" - priority = 500 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "22" - - # TODO: Reference subnet - source_address_prefix = "${var.ssh_network_internal}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "master_ingress_ssh_admin" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-ssh-external" - description = "${var.cluster_name} master - SSH external" - priority = 505 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "22" - - # TODO: Reference subnet - source_address_prefix = "${var.ssh_network_external}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "master_ingress_flannel" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-udp-4789" - description = "${var.cluster_name} master - flannel" - priority = 510 - direction = "Inbound" - access = "Allow" - protocol = "UDP" - source_port_range = "*" - destination_port_range = "4789" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "master_ingress_node_exporter_from_master" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-tcp-9100-master" - description = "${var.cluster_name} master - Prometheus node exporter from master" - priority = 515 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "9100" - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "master_ingress_node_exporter_from_worker" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-tcp-9100-worker" - description = "${var.cluster_name} master - Prometheus node exporter from worker" - priority = 520 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "9100" - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -# TODO: Review NSG -resource "azurerm_network_security_rule" "master_ingress_k8s_nodeport_from_alb" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-any-30000-32767-alb" - description = "${var.cluster_name} master - Kubernetes NodePort range from Azure Load Balancer" - priority = 525 - direction = "Inbound" - access = "Allow" - protocol = "*" - source_port_range = "*" - destination_port_range = "30000-32767" - - # TODO: Reference subnet - source_address_prefix = "AzureLoadBalancer" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -# TODO: Review NSG -resource "azurerm_network_security_rule" "master_ingress_k8s_nodeport" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-any-30000-32767" - description = "${var.cluster_name} master - Kubernetes NodePort range" - priority = 530 - direction = "Inbound" - access = "Allow" - protocol = "*" - source_port_range = "*" - destination_port_range = "30000-32767" - - # TODO: Reference subnet - source_address_prefix = "*" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} - -resource "azurerm_network_security_rule" "master_ingress_kubelet_secure" { - count = "${var.external_nsg_master_id == "" ? 1 : 0}" - name = "${var.cluster_name}-master-in-tcp-10255-vnet" - description = "${var.cluster_name} master - kubelet" - priority = 535 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "10255" - - # TODO: CR on how open this should be - # TODO: Reference subnet - source_address_prefix = "VirtualNetwork" - - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.master.name}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%nsg-worker.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%nsg-worker.tf deleted file mode 100644 index f00703886..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%nsg-worker.tf +++ /dev/null @@ -1,169 +0,0 @@ -resource "azurerm_network_security_group" "worker" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker" - location = "${var.location}" - resource_group_name = "${var.resource_group_name}" -} - -resource "azurerm_network_security_rule" "worker_egress" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-out" - description = "${var.cluster_name} worker - Outbound" - priority = 2010 - direction = "Outbound" - access = "Allow" - protocol = "*" - source_port_range = "*" - destination_port_range = "*" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "*" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -resource "azurerm_network_security_rule" "worker_ingress_ssh" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-ssh" - description = "${var.cluster_name} worker - SSH" - priority = 600 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "22" - - # TODO: Reference subnet - source_address_prefix = "${var.ssh_network_internal}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -resource "azurerm_network_security_rule" "worker_ingress_ssh_admin" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-ssh-external" - description = "${var.cluster_name} worker - SSH external" - priority = 605 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "22" - - # TODO: Reference subnet - source_address_prefix = "${var.ssh_network_external}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -# TODO: Determine if we need two rules for this -resource "azurerm_network_security_rule" "worker_ingress_k8s_nodeport" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-any-30000-32767" - description = "${var.cluster_name} worker - Kubernetes NodePort range" - priority = 610 - direction = "Inbound" - access = "Allow" - protocol = "*" - source_port_range = "*" - destination_port_range = "30000-32767" - source_address_prefix = "VirtualNetwork" - destination_address_prefix = "*" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -resource "azurerm_network_security_rule" "worker_ingress_flannel" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-udp-4789" - description = "${var.cluster_name} worker - flannel" - priority = 615 - direction = "Inbound" - access = "Allow" - protocol = "UDP" - source_port_range = "*" - destination_port_range = "4789" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -resource "azurerm_network_security_rule" "worker_ingress_kubelet_secure" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-tcp-10255-vnet" - description = "${var.cluster_name} worker - kubelet" - priority = 620 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "10255" - - # TODO: CR on how open this should be - # TODO: Reference subnet - source_address_prefix = "VirtualNetwork" - - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -resource "azurerm_network_security_rule" "worker_ingress_node_exporter_from_worker" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-tcp-9100-vnet" - description = "${var.cluster_name} worker - Prometheus node exporter from worker" - priority = 625 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "9100" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -resource "azurerm_network_security_rule" "worker_ingress_node_exporter_from_master" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-tcp-9100-master" - description = "${var.cluster_name} worker - Prometheus node exporter from master" - priority = 630 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "9100" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} - -resource "azurerm_network_security_rule" "worker_ingress_heapster_from_master" { - count = "${var.external_nsg_worker_id == "" ? 1 : 0}" - name = "${var.cluster_name}-worker-in-tcp-4194-master" - description = "${var.cluster_name} worker - Heapster from master" - priority = 635 - direction = "Inbound" - access = "Allow" - protocol = "TCP" - source_port_range = "*" - destination_port_range = "4194" - - # TODO: Reference subnet - source_address_prefix = "${var.vnet_cidr_block}" - destination_address_prefix = "${var.vnet_cidr_block}" - resource_group_name = "${var.resource_group_name}" - network_security_group_name = "${azurerm_network_security_group.worker.name}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%outputs.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%outputs.tf deleted file mode 100644 index d7eca83ca..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%outputs.tf +++ /dev/null @@ -1,84 +0,0 @@ -locals { - # A regular expression that parses a Azure subnet id to extract subnet name. - const_id_to_subnet_name_regex = "/^/subscriptions/[-\\w]+/resourceGroups/[-\\w]+/providers/Microsoft.Network/virtualNetworks/[.\\w]+/subnets/([.\\w-]+)$/" - - # A regular expression that parses Azure resource IDs into component identifiers - const_id_to_group_name_regex = "/^/subscriptions/[-\\w]+/resourceGroups/([\\w()-\\.]+)/providers/[.\\w]+/[.\\w]+/([.\\w-]+)$/" -} - -output "vnet_id" { - value = "${var.external_vnet_id == "" ? element(concat(azurerm_virtual_network.tectonic_vnet.*.name, list("")), 0) : replace(var.external_vnet_id, local.const_id_to_group_name_regex, "$2")}" -} - -output "master_subnet" { - value = "${var.external_master_subnet_id == "" ? element(concat(azurerm_subnet.master_subnet.*.id, list("")), 0) : var.external_master_subnet_id}" -} - -output "worker_subnet" { - value = "${var.external_worker_subnet_id == "" ? element(concat(azurerm_subnet.worker_subnet.*.id, list("")), 0) : var.external_worker_subnet_id}" -} - -output "worker_subnet_name" { - value = "${var.external_worker_subnet_id == "" ? element(concat(azurerm_subnet.worker_subnet.*.name, list("")), 0) : replace(var.external_worker_subnet_id, local.const_id_to_subnet_name_regex, "$1")}" -} - -output "vnet_resource_group" { - value = "${var.external_vnet_id == "" ? "" : replace(var.external_vnet_id, local.const_id_to_group_name_regex, "$1")}" -} - -# TODO: Allow user to provide their own network -output "etcd_cidr" { - value = "${element(concat(azurerm_subnet.master_subnet.*.address_prefix, list("")), 0)}" -} - -output "master_cidr" { - value = "${element(concat(azurerm_subnet.master_subnet.*.address_prefix, list("")), 0)}" -} - -output "worker_cidr" { - value = "${element(concat(azurerm_subnet.worker_subnet.*.address_prefix, list("")), 0)}" -} - -output "worker_nsg_name" { - value = "${var.external_nsg_worker_id == "" ? element(concat(azurerm_network_security_group.worker.*.name, list("")), 0) : var.external_nsg_worker_id}" -} - -output "etcd_network_interface_ids" { - value = ["${azurerm_network_interface.etcd_nic.*.id}"] -} - -output "etcd_endpoints" { - value = "${azurerm_network_interface.etcd_nic.*.private_ip_address}" -} - -output "master_network_interface_ids" { - value = ["${azurerm_network_interface.tectonic_master.*.id}"] -} - -output "worker_network_interface_ids" { - value = ["${azurerm_network_interface.tectonic_worker.*.id}"] -} - -output "master_private_ip_addresses" { - value = ["${azurerm_network_interface.tectonic_master.*.private_ip_address}"] -} - -output "worker_private_ip_addresses" { - value = ["${azurerm_network_interface.tectonic_worker.*.private_ip_address}"] -} - -output "api_ip_addresses" { - value = ["${split("|", var.private_cluster ? join("|", azurerm_network_interface.tectonic_master.*.private_ip_address) : join("|", azurerm_public_ip.api_ip.*.ip_address))}"] -} - -output "console_ip_addresses" { - value = ["${split("|", var.private_cluster ? join("|", azurerm_network_interface.tectonic_worker.*.private_ip_address) : join("|", azurerm_public_ip.console_ip.*.ip_address))}"] -} - -output "ingress_fqdn" { - value = "${var.base_domain == "" ? element(concat(azurerm_public_ip.console_ip.*.fqdn, list("")), 0) : "${var.cluster_name}.${var.base_domain}${var.private_cluster ? ":32000" : ""}"}" -} - -output "api_fqdn" { - value = "${var.base_domain == "" ? element(concat(azurerm_public_ip.api_ip.*.fqdn, list("")), 0) : "${var.cluster_name}-api.${var.base_domain}"}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%variables.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%variables.tf deleted file mode 100644 index df7c218da..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%variables.tf +++ /dev/null @@ -1,96 +0,0 @@ -variable "cluster_name" { - type = "string" -} - -variable "cluster_id" { - type = "string" -} - -// The base DNS domain of the cluster. -// Example: `azure.dev.coreos.systems` -variable "base_domain" { - type = "string" -} - -variable "resource_group_name" { - type = "string" -} - -variable "vnet_cidr_block" { - type = "string" -} - -variable "location" { - type = "string" -} - -variable "external_vnet_id" { - type = "string" - default = "" -} - -variable "external_master_subnet_id" { - type = "string" - default = "" -} - -variable "external_worker_subnet_id" { - type = "string" - default = "" -} - -variable "external_nsg_master_id" { - type = "string" - default = "" -} - -variable "external_nsg_worker_id" { - type = "string" - default = "" -} - -variable "etcd_cidr" { - type = "string" - default = "" -} - -variable "etcd_count" { - type = "string" - default = "" -} - -variable "master_cidr" { - type = "string" - default = "" -} - -variable "worker_cidr" { - type = "string" - default = "" -} - -variable "ssh_network_internal" { - type = "string" - default = "" -} - -variable "ssh_network_external" { - type = "string" - default = "" -} - -variable "master_count" { - type = "string" -} - -variable "worker_count" { - type = "string" -} - -variable "extra_tags" { - type = "map" -} - -variable "private_cluster" { - default = false -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%vnet-subnets.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%vnet-subnets.tf deleted file mode 100644 index 6604b92b2..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%vnet%vnet-subnets.tf +++ /dev/null @@ -1,30 +0,0 @@ -resource "azurerm_virtual_network" "tectonic_vnet" { - count = "${var.external_vnet_id == "" ? 1 : 0 }" - name = "${var.cluster_name}" - resource_group_name = "${var.resource_group_name}" - address_space = ["${var.vnet_cidr_block}"] - location = "${var.location}" - - tags = "${merge(map( - "Name", "${var.cluster_name}_vnet", - "tectonicClusterID", "${var.cluster_id}"), - var.extra_tags)}" -} - -resource "azurerm_subnet" "master_subnet" { - count = "${var.external_master_subnet_id == "" ? 1 : 0}" - name = "${var.cluster_name}_master_subnet" - resource_group_name = "${var.external_vnet_id == "" ? var.resource_group_name : replace(var.external_vnet_id, "${var.const_id_to_group_name_regex}", "$1")}" - virtual_network_name = "${var.external_vnet_id == "" ? join("",azurerm_virtual_network.tectonic_vnet.*.name) : replace(var.external_vnet_id, "${var.const_id_to_group_name_regex}", "$2")}" - address_prefix = "${cidrsubnet(var.vnet_cidr_block, 4, 0)}" - network_security_group_id = "${var.external_nsg_master_id == "" ? azurerm_network_security_group.master.id : var.external_nsg_master_id}" -} - -resource "azurerm_subnet" "worker_subnet" { - count = "${var.external_worker_subnet_id == "" ? 1 : 0}" - name = "${var.cluster_name}_worker_subnet" - resource_group_name = "${var.external_vnet_id == "" ? var.resource_group_name : replace(var.external_vnet_id, "${var.const_id_to_group_name_regex}", "$1")}" - virtual_network_name = "${var.external_vnet_id == "" ? join("",azurerm_virtual_network.tectonic_vnet.*.name) : replace(var.external_vnet_id, "${var.const_id_to_group_name_regex}", "$2") }" - address_prefix = "${cidrsubnet(var.vnet_cidr_block, 4, 1)}" - network_security_group_id = "${var.external_nsg_worker_id == "" ? azurerm_network_security_group.worker.id : var.external_nsg_worker_id}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%ignition-worker.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%ignition-worker.tf deleted file mode 100644 index d388e45dc..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%ignition-worker.tf +++ /dev/null @@ -1,58 +0,0 @@ -data "ignition_config" "worker" { - files = ["${compact(list( - data.ignition_file.cloud-provider-config.id, - data.ignition_file.kubeconfig.id, - var.ign_azure_udev_rules_id, - var.ign_installer_kubelet_env_id, - var.ign_installer_runtime_mappings_id, - var.ign_max_user_watches_id, - var.ign_nfs_config_id, - var.ign_ntp_dropin_id, - var.ign_profile_env_id, - var.ign_systemd_default_env_id, - ))}", - "${var.ign_ca_cert_id_list}", - ] - - systemd = [ - "${var.ign_docker_dropin_id}", - "${var.ign_iscsi_service_id}", - "${var.ign_k8s_node_bootstrap_service_id}", - "${var.ign_kubelet_service_id}", - "${var.ign_locksmithd_service_id}", - "${var.ign_tx_off_service_id}", - "${var.ign_update_ca_certificates_dropin_id}", - ] - - users = [ - "${data.ignition_user.core.id}", - ] -} - -data "ignition_file" "kubeconfig" { - filesystem = "root" - path = "/etc/kubernetes/kubeconfig" - mode = 0644 - - content { - content = "${var.kubeconfig_content}" - } -} - -data "ignition_file" "cloud-provider-config" { - filesystem = "root" - path = "/etc/kubernetes/cloud/config" - mode = 0600 - - content { - content = "${var.cloud_provider_config}" - } -} - -data "ignition_user" "core" { - name = "core" - - ssh_authorized_keys = [ - "${file(var.public_ssh_key)}", - ] -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%output.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%output.tf deleted file mode 100644 index eff294cc9..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%output.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "availability_set_name" { - value = "${azurerm_availability_set.tectonic_workers.name}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%variables.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%variables.tf deleted file mode 100644 index 02c18955c..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%variables.tf +++ /dev/null @@ -1,92 +0,0 @@ -variable "container_linux_channel" { - type = "string" -} - -variable "container_linux_version" { - type = "string" -} - -variable "cloud_provider" { - type = "string" - default = "azure" -} - -variable "cloud_provider_config" { - description = "Content of cloud provider config" - type = "string" -} - -variable "cluster_id" { - type = "string" -} - -variable "cluster_name" { - type = "string" - description = "The name of the cluster." -} - -variable "extra_tags" { - type = "map" -} - -variable "ign_azure_udev_rules_id" { - type = "string" -} - -variable "ign_tx_off_service_id" { - type = "string" -} - -variable "kubeconfig_content" { - type = "string" - default = "" -} - -variable "location" { - type = "string" - description = "Location is the Azure Location (East US, West US, etc)" -} - -variable "network_interface_ids" { - type = "list" - description = "List of NICs to use for master VMs" -} - -variable "public_ssh_key" { - type = "string" -} - -variable "resource_group_name" { - type = "string" -} - -variable "storage_id" { - type = "string" -} - -variable "storage_type" { - type = "string" - description = "Storage account type" -} - -variable "root_volume_size" { - type = "string" -} - -variable "tectonic_kube_dns_service_ip" { - type = "string" -} - -variable "vm_size" { - type = "string" - description = "VM Size name" -} - -variable "worker_count" { - type = "string" - description = "Count of worker nodes to be created." -} - -variable "fault_domains" { - type = "string" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%workers.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%workers.tf deleted file mode 100644 index a0ed9f786..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%azure%worker-as%workers.tf +++ /dev/null @@ -1,68 +0,0 @@ -resource "azurerm_availability_set" "tectonic_workers" { - name = "${var.cluster_name}-workers" - location = "${var.location}" - resource_group_name = "${var.resource_group_name}" - managed = true - platform_fault_domain_count = "${var.fault_domains}" - - tags = "${merge(map( - "Name", "${var.cluster_name}-workers", - "tectonicClusterID", "${var.cluster_id}"), - var.extra_tags)}" -} - -resource "azurerm_virtual_machine" "tectonic_worker" { - count = "${var.worker_count}" - name = "${var.cluster_name}-worker-${count.index}" - location = "${var.location}" - resource_group_name = "${var.resource_group_name}" - network_interface_ids = ["${var.network_interface_ids[count.index]}"] - vm_size = "${var.vm_size}" - availability_set_id = "${azurerm_availability_set.tectonic_workers.id}" - - delete_os_disk_on_termination = true - - storage_image_reference { - publisher = "CoreOS" - offer = "CoreOS" - sku = "${var.container_linux_channel}" - version = "${var.container_linux_version}" - } - - storage_os_disk { - name = "worker-${count.index}-os-${var.storage_id}" - managed_disk_type = "${var.storage_type}" - create_option = "FromImage" - caching = "ReadWrite" - os_type = "linux" - disk_size_gb = "${var.root_volume_size}" - } - - os_profile { - computer_name = "${var.cluster_name}-worker-${count.index}" - admin_username = "core" - admin_password = "" - custom_data = "${base64encode("${data.ignition_config.worker.rendered}")}" - } - - os_profile_linux_config { - disable_password_authentication = true - - ssh_keys { - path = "/home/core/.ssh/authorized_keys" - key_data = "${file(var.public_ssh_key)}" - } - } - - tags = "${merge(map( - "Name", "${var.cluster_name}-worker-${count.index}", - "tectonicClusterID", "${var.cluster_id}"), - var.extra_tags)}" - - lifecycle { - ignore_changes = [ - "storage_os_disk", - "storage_data_disk", - ] - } -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%assets.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%assets.tf deleted file mode 100644 index f9bad2d02..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%assets.tf +++ /dev/null @@ -1,85 +0,0 @@ -# kubeconfig (/auth/kubeconfig) -data "template_file" "kubeconfig" { - template = "${file("${path.module}/resources/kubeconfig")}" - - vars { - root_ca_cert = "${base64encode(var.root_ca_cert_pem)}" - admin_cert = "${base64encode(var.admin_cert_pem)}" - admin_key = "${base64encode(var.admin_key_pem)}" - server = "${var.kube_apiserver_url}" - cluster_name = "${var.cluster_name}" - } -} - -data "ignition_file" "kubeconfig" { - filesystem = "root" - path = "/opt/tectonic/auth/kubeconfig" - mode = "0600" - - content { - content = "${data.template_file.kubeconfig.rendered}" - } -} - -# kubeconfig-kubelet -data "template_file" "kubeconfig-kubelet" { - template = "${file("${path.module}/resources/kubeconfig-kubelet")}" - - vars { - root_ca_cert = "${base64encode(var.root_ca_cert_pem)}" - client_cert = "${base64encode(var.kubelet_cert_pem)}" - client_key = "${base64encode(var.kubelet_key_pem)}" - server = "${var.kube_apiserver_url}" - cluster_name = "${var.cluster_name}" - } -} - -data "ignition_file" "kubeconfig-kubelet" { - filesystem = "root" - path = "/opt/tectonic/auth/kubeconfig-kubelet" - mode = "0600" - - content { - content = "${data.template_file.kubeconfig-kubelet.rendered}" - } -} - -# bootkube.sh -data "template_file" "bootkube_sh" { - template = "${file("${path.module}/resources/bootkube.sh")}" - - vars { - bootkube_image = "${var.container_images["bootkube"]}" - kube_core_renderer_image = "${var.container_images["kube_core_renderer"]}" - tnc_operator_image = "${var.container_images["tnc_operator"]}" - etcd_cert_signer_image = "${var.container_images["etcd_cert_signer"]}" - etcdctl_image = "${var.container_images["etcd"]}" - etcd_cluster = "${join(",", data.template_file.initial_cluster.*.rendered)}" - } -} - -data "ignition_file" "bootkube_sh" { - filesystem = "root" - path = "/opt/tectonic/bootkube.sh" - mode = "0755" - - content { - content = "${data.template_file.bootkube_sh.rendered}" - } -} - -# bootkube.service (available as output variable) -data "template_file" "bootkube_service" { - template = "${file("${path.module}/resources/bootkube.service")}" -} - -data "ignition_systemd_unit" "bootkube_service" { - name = "bootkube.service" - enabled = false - content = "${data.template_file.bootkube_service.rendered}" -} - -data "template_file" "initial_cluster" { - count = "${length(var.etcd_endpoints)}" - template = "https://${var.etcd_endpoints[count.index]}:2379" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%assets.tf-288 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%assets.tf-288 deleted file mode 100644 index 00ec5c61b..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%assets.tf-288 +++ /dev/null @@ -1,162 +0,0 @@ -# Self-hosted manifests (resources/generated/manifests/) -resource "template_dir" "bootkube" { - source_dir = "${path.module}/resources/manifests" - destination_dir = "./generated/manifests" - - vars { - hyperkube_image = "${var.container_images["hyperkube"]}" - pod_checkpointer_image = "${var.container_images["pod_checkpointer"]}" - kubedns_image = "${var.container_images["kubedns"]}" - kubednsmasq_image = "${var.container_images["kubednsmasq"]}" - kubedns_sidecar_image = "${var.container_images["kubedns_sidecar"]}" - - # Choose the etcd endpoints to use. - # 1. If self-hosted etcd is enabled, then use - # var.etcd_service_ip. - # 2. Else if no etcd TLS certificates are provided, i.e. we bootstrap etcd - # nodes ourselves (using http), then use insecure http var.etcd_endpoints. - # 3. Else (if etcd TLS certific are provided), then use the secure https - # var.etcd_endpoints. - etcd_servers = "${ - var.self_hosted_etcd != "" - ? format("https://%s:2379", cidrhost(var.service_cidr, 15)) - : var.etcd_tls_enabled - ? join(",", formatlist("https://%s:2379", var.etcd_endpoints)) - : join(",", formatlist("http://%s:2379", var.etcd_endpoints)) - }" - - etcd_service_ip = "${cidrhost(var.service_cidr, 15)}" - bootstrap_etcd_service_ip = "${cidrhost(var.service_cidr, 20)}" - - cloud_provider = "${var.cloud_provider}" - cloud_provider_config = "${var.cloud_provider_config}" - cloud_provider_config_flag = "${var.cloud_provider_config != "" ? "- --cloud-config=/etc/kubernetes/cloud/config" : "# no cloud provider config given"}" - - cluster_cidr = "${var.cluster_cidr}" - service_cidr = "${var.service_cidr}" - kube_dns_service_ip = "${cidrhost(var.service_cidr, 10)}" - advertise_address = "${var.advertise_address}" - - anonymous_auth = "${var.anonymous_auth}" - oidc_issuer_url = "${var.oidc_issuer_url}" - oidc_client_id = "${var.oidc_client_id}" - oidc_username_claim = "${var.oidc_username_claim}" - oidc_groups_claim = "${var.oidc_groups_claim}" - oidc_ca_cert = "${base64encode(var.oidc_ca_cert)}" - - kube_ca_cert = "${base64encode(var.kube_ca_cert_pem)}" - apiserver_key = "${base64encode(var.apiserver_key_pem)}" - apiserver_cert = "${base64encode(var.apiserver_cert_pem)}" - serviceaccount_pub = "${base64encode(tls_private_key.service_account.public_key_pem)}" - serviceaccount_key = "${base64encode(tls_private_key.service_account.private_key_pem)}" - - etcd_ca_flag = "${var.etcd_ca_cert_pem != "" ? "- --etcd-cafile=/etc/kubernetes/secrets/etcd-client-ca.crt" : "# no etcd-client-ca.crt given" }" - etcd_cert_flag = "${var.etcd_client_cert_pem != "" ? "- --etcd-certfile=/etc/kubernetes/secrets/etcd-client.crt" : "# no etcd-client.crt given" }" - etcd_key_flag = "${var.etcd_client_key_pem != "" ? "- --etcd-keyfile=/etc/kubernetes/secrets/etcd-client.key" : "# no etcd-client.key given" }" - - etcd_ca_cert = "${base64encode(var.etcd_ca_cert_pem)}" - etcd_client_cert = "${base64encode(var.etcd_client_cert_pem)}" - etcd_client_key = "${base64encode(var.etcd_client_key_pem)}" - - kubernetes_version = "${replace(var.versions["kubernetes"], "+", "-")}" - - master_count = "${var.master_count}" - node_monitor_grace_period = "${var.node_monitor_grace_period}" - pod_eviction_timeout = "${var.pod_eviction_timeout}" - - cloud_provider_profile = "${var.cloud_provider != "" ? "${var.cloud_provider}" : "metal"}" - cloud_config_path = "${var.cloud_config_path}" - } -} - -# Self-hosted bootstrapping manifests (resources/generated/manifests-bootstrap/) -resource "template_dir" "bootkube_bootstrap" { - source_dir = "${path.module}/resources/bootstrap-manifests" - destination_dir = "./generated/bootstrap-manifests" - - vars { - hyperkube_image = "${var.container_images["hyperkube"]}" - etcd_image = "${var.container_images["etcd"]}" - - # Choose the etcd endpoints to use. - # 1. If self-hosted etcd mode is enabled, then use - # var.etcd_service_ip. - # 2. Else if no etcd TLS certificates are provided, i.e. we bootstrap etcd - # nodes ourselves (using http), then use insecure http var.etcd_endpoints. - # 3. Else (if etcd TLS certific are provided), then use the secure https - # var.etcd_endpoints. - etcd_servers = "${ - var.self_hosted_etcd != "" - ? format("https://%s:2379,https://127.0.0.1:12379", cidrhost(var.service_cidr, 15)) - : var.etcd_tls_enabled - ? join(",", formatlist("https://%s:2379", var.etcd_endpoints)) - : join(",", formatlist("http://%s:2379", var.etcd_endpoints)) - }" - - etcd_ca_flag = "${var.etcd_ca_cert_pem != "" ? "- --etcd-cafile=/etc/kubernetes/secrets/etcd-client-ca.crt" : "# no etcd-client-ca.crt given" }" - etcd_cert_flag = "${var.etcd_client_cert_pem != "" ? "- --etcd-certfile=/etc/kubernetes/secrets/etcd-client.crt" : "# no etcd-client.crt given" }" - etcd_key_flag = "${var.etcd_client_key_pem != "" ? "- --etcd-keyfile=/etc/kubernetes/secrets/etcd-client.key" : "# no etcd-client.key given" }" - - cloud_provider = "${var.cloud_provider}" - cloud_provider_config = "${var.cloud_provider_config}" - cloud_provider_config_flag = "${var.cloud_provider_config != "" ? "- --cloud-config=/etc/kubernetes/cloud/config" : "# no cloud provider config given"}" - - advertise_address = "${var.advertise_address}" - cluster_cidr = "${var.cluster_cidr}" - service_cidr = "${var.service_cidr}" - } -} - -# kubeconfig (resources/generated/auth/kubeconfig) -data "template_file" "kubeconfig" { - template = "${file("${path.module}/resources/kubeconfig")}" - - vars { - kube_ca_cert = "${base64encode(var.kube_ca_cert_pem)}" - kubelet_cert = "${base64encode(var.kubelet_cert_pem)}" - kubelet_key = "${base64encode(var.kubelet_key_pem)}" - server = "${var.kube_apiserver_url}" - cluster_name = "${var.cluster_name}" - } -} - -resource "local_file" "kubeconfig" { - content = "${data.template_file.kubeconfig.rendered}" - filename = "./generated/auth/kubeconfig" -} - -# bootkube.sh (resources/generated/bootkube.sh) -data "template_file" "bootkube_sh" { - template = "${file("${path.module}/resources/bootkube.sh")}" - - vars { - bootkube_image = "${var.container_images["bootkube"]}" - } -} - -resource "local_file" "bootkube_sh" { - content = "${data.template_file.bootkube_sh.rendered}" - filename = "./generated/bootkube.sh" -} - -# bootkube.service (available as output variable) -data "template_file" "bootkube_service" { - template = "${file("${path.module}/resources/bootkube.service")}" -} - -data "ignition_systemd_unit" "bootkube_service" { - name = "bootkube.service" - enabled = false - content = "${data.template_file.bootkube_service.rendered}" -} - -# bootkube.path (available as output variable) -data "template_file" "bootkube_path_unit" { - template = "${file("${path.module}/resources/bootkube.path")}" -} - -data "ignition_systemd_unit" "bootkube_path_unit" { - name = "bootkube.path" - enabled = true - content = "${data.template_file.bootkube_path_unit.rendered}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%outputs.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%outputs.tf deleted file mode 100644 index 582e029f6..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%outputs.tf +++ /dev/null @@ -1,32 +0,0 @@ -output "kubeconfig-kubelet" { - value = "${data.template_file.kubeconfig-kubelet.rendered}" -} - -output "systemd_service_id" { - value = "${data.ignition_systemd_unit.bootkube_service.id}" -} - -output "kube_dns_service_ip" { - value = "${cidrhost(var.service_cidr, 10)}" -} - -output "kubeconfig_rendered" { - value = "${data.template_file.kubeconfig.rendered}" -} - -output "kubeconfig-kubelet_rendered" { - value = "${data.template_file.kubeconfig-kubelet.rendered}" -} - -output "ignition_file_id_list" { - value = ["${flatten(list( - list( - data.ignition_file.bootkube_sh.id, - data.ignition_file.kubeconfig.id, - data.ignition_file.kubeconfig-kubelet.id, - data.ignition_file.service_account_key.id, - data.ignition_file.service_account_crt.id, - ), - data.ignition_file.manifest_file_list.*.id, - ))}"] -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%outputs.tf-37 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%outputs.tf-37 deleted file mode 100644 index e6e016610..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%outputs.tf-37 +++ /dev/null @@ -1,55 +0,0 @@ -# This output is meant to be used to inject a dependency on the generated -# assets. As of Terraform v0.9, it is difficult to make a module depend on -# another module (no depends_on, no triggers), or to make a data source -# depend on a module (no depends_on, no triggers, generally no dummy variable). -# -# For instance, using the 'archive_file' data source against the generated -# assets, which is a common use-case, is tricky. There is no mechanism for -# defining explicit dependencies and the only available variables are for the -# source, destination and archive type, leaving little opportunities for us to -# inject a dependency. Thanks to the property described below, this output can -# be used as part of the output filename, in order to enforce the creation of -# the archive after the assets have been properly generated. -# -# Both localfile and template_dir providers compute their IDs by hashing -# the content of the resources on disk. Because this output is computed from the -# combination of all the resources' IDs, it can't be guessed and can only be -# interpolated once the assets have all been created. -output "id" { - value = "${sha1(" - ${local_file.kubeconfig.id} - ${local_file.bootkube_sh.id} - ${template_dir.bootkube.id} ${template_dir.bootkube_bootstrap.id} - ${join(" ", - template_dir.etcd_manifests.*.id, - template_dir.etcd_bootstrap_manifests.*.id, - local_file.etcd_bootstrap_service.*.id, - local_file.migrate_etcd_cluster.*.id, - local_file.migrate_etcd_cluster_pv_backup.*.id, - )} - ")}" -} - -output "kubeconfig" { - value = "${data.template_file.kubeconfig.rendered}" -} - -output "systemd_service_rendered" { - value = "${data.template_file.bootkube_service.rendered}" -} - -output "systemd_service_id" { - value = "${data.ignition_systemd_unit.bootkube_service.id}" -} - -output "systemd_path_unit_rendered" { - value = "${data.template_file.bootkube_path_unit.rendered}" -} - -output "systemd_path_unit_id" { - value = "${data.ignition_systemd_unit.bootkube_path_unit.id}" -} - -output "kube_dns_service_ip" { - value = "${cidrhost(var.service_cidr, 10)}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%self-hosted-etcd.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%self-hosted-etcd.tf deleted file mode 100644 index 4eaef96b9..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%self-hosted-etcd.tf +++ /dev/null @@ -1,80 +0,0 @@ -resource "template_dir" "etcd_manifests" { - count = "${var.self_hosted_etcd != "" ? 1 : 0}" - source_dir = "${path.module}/resources/self-hosted-etcd/manifests" - destination_dir = "./generated/etcd/manifests" - - vars { - etcd_operator_image = "${var.container_images["etcd_operator"]}" - etcd_service_ip = "${cidrhost(var.service_cidr, 15)}" - kenc_image = "${var.container_images["kenc"]}" - - etcd_ca_cert = "${base64encode(var.etcd_ca_cert_pem)}" - - etcd_server_cert = "${base64encode(var.etcd_server_cert_pem)}" - etcd_server_key = "${base64encode(var.etcd_server_key_pem)}" - - etcd_client_cert = "${base64encode(var.etcd_client_cert_pem)}" - etcd_client_key = "${base64encode(var.etcd_client_key_pem)}" - - etcd_peer_cert = "${base64encode(var.etcd_peer_cert_pem)}" - etcd_peer_key = "${base64encode(var.etcd_peer_key_pem)}" - } -} - -resource "template_dir" "etcd_bootstrap_manifests" { - count = "${var.self_hosted_etcd != "" ? 1 : 0}" - source_dir = "${path.module}/resources/self-hosted-etcd/bootstrap-manifests" - destination_dir = "./generated/etcd/bootstrap-manifests" - - vars { - etcd_image = "${var.container_images["etcd"]}" - etcd_version = "${var.versions["etcd"]}" - bootstrap_etcd_service_ip = "${cidrhost(var.service_cidr, 20)}" - } -} - -data "template_file" "etcd_bootstrap_service" { - template = "${file("${path.module}/resources/self-hosted-etcd/bootstrap-etcd-service.json")}" - - vars { - bootstrap_etcd_service_ip = "${cidrhost(var.service_cidr, 20)}" - } -} - -resource "local_file" "etcd_bootstrap_service" { - count = "${var.self_hosted_etcd != "" ? 1 : 0}" - content = "${data.template_file.etcd_bootstrap_service.rendered}" - filename = "./generated/etcd/bootstrap-etcd-service.json" -} - -data "template_file" "migrate_etcd_cluster" { - template = "${file("${path.module}/resources/self-hosted-etcd/migrate-etcd-cluster.json")}" - - vars { - etcd_version = "${var.versions["etcd"]}" - bootstrap_etcd_service_ip = "${cidrhost(var.service_cidr, 20)}" - } -} - -resource "local_file" "migrate_etcd_cluster" { - count = "${var.self_hosted_etcd == "enabled" ? 1 : 0}" - content = "${data.template_file.migrate_etcd_cluster.rendered}" - filename = "./generated/etcd/migrate-etcd-cluster.json" -} - -data "template_file" "migrate_etcd_cluster_pv_backup" { - template = "${file("${path.module}/resources/self-hosted-etcd/migrate-etcd-cluster-pv-backup.json")}" - - vars { - etcd_version = "${var.versions["etcd"]}" - bootstrap_etcd_service_ip = "${cidrhost(var.service_cidr, 20)}" - etcd_backup_size = "${var.etcd_backup_size}" - etcd_backup_storage_class = "${var.etcd_backup_storage_class}" - } -} - -resource "local_file" "migrate_etcd_cluster_pv_backup" { - count = "${var.self_hosted_etcd == "pv_backup" ? 1 : 0}" - content = "${data.template_file.migrate_etcd_cluster_pv_backup.rendered}" - filename = "./generated/etcd/migrate-etcd-cluster.json" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%service-account.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%service-account.tf deleted file mode 100644 index 0c4e57186..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%service-account.tf +++ /dev/null @@ -1,35 +0,0 @@ -# Kubernete's Service Account (resources/generated/tls/{service-account.key,service-account.pub}) -resource "tls_private_key" "service_account" { - algorithm = "RSA" - rsa_bits = "2048" -} - -resource "local_file" "service_account_key" { - content = "${tls_private_key.service_account.private_key_pem}" - filename = "./generated/tls/service-account.key" -} - -data "ignition_file" "service_account_key" { - filesystem = "root" - path = "/opt/tectonic/tls/service-account.key" - mode = "0644" - - content { - content = "${tls_private_key.service_account.private_key_pem}" - } -} - -resource "local_file" "service_account_crt" { - content = "${tls_private_key.service_account.public_key_pem}" - filename = "./generated/tls/service-account.pub" -} - -data "ignition_file" "service_account_crt" { - filesystem = "root" - path = "/opt/tectonic/tls/service-account.pub" - mode = "0644" - - content { - content = "${tls_private_key.service_account.public_key_pem}" - } -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%service-account.tf-289 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%service-account.tf-289 deleted file mode 100644 index 00fbaf11a..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%service-account.tf-289 +++ /dev/null @@ -1,15 +0,0 @@ -# Kubernete's Service Account (resources/generated/tls/{service-account.key,service-account.pub}) -resource "tls_private_key" "service_account" { - algorithm = "RSA" - rsa_bits = "2048" -} - -resource "local_file" "service_account_key" { - content = "${tls_private_key.service_account.private_key_pem}" - filename = "./generated/tls/service-account.key" -} - -resource "local_file" "service_account_crt" { - content = "${tls_private_key.service_account.public_key_pem}" - filename = "./generated/tls/service-account.pub" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%variables.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%variables.tf deleted file mode 100644 index 6aba39695..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%variables.tf +++ /dev/null @@ -1,147 +0,0 @@ -variable "apiserver_cert_pem" { - type = "string" - description = "The API server certificate in PEM format." -} - -variable "apiserver_key_pem" { - type = "string" - description = "The API server key in PEM format." -} - -variable "openshift_apiserver_cert_pem" { - type = "string" - description = "The Openshift API server certificate in PEM format." -} - -variable "openshift_apiserver_key_pem" { - type = "string" - description = "The Openshift API server key in PEM format." -} - -variable "apiserver_proxy_cert_pem" { - type = "string" - description = "The API server proxy certificate in PEM format." -} - -variable "apiserver_proxy_key_pem" { - type = "string" - description = "The API server proxy key in PEM format." -} - -variable "cloud_provider_config" { - description = "Content of cloud provider config" - type = "string" - default = "" -} - -variable "cluster_name" { - type = "string" -} - -variable "container_images" { - description = "Container images to use" - type = "map" -} - -variable "etcd_ca_cert_pem" { - type = "string" - description = "The etcd CA certificate in PEM format." -} - -variable "etcd_client_cert_pem" { - type = "string" - description = "The etcd client certificate in PEM format." -} - -variable "etcd_client_key_pem" { - type = "string" - description = "The etcd client key in PEM format." -} - -variable "etcd_endpoints" { - description = "List of etcd endpoints to connect with (hostnames/IPs only)" - type = "list" -} - -variable "kube_apiserver_url" { - description = "URL used to reach kube-apiserver" - type = "string" -} - -variable "root_ca_cert_pem" { - type = "string" - description = "The Root CA in PEM format." -} - -variable "aggregator_ca_cert_pem" { - type = "string" - description = "The Aggregated API Server CA in PEM format." -} - -variable "aggregator_ca_key_pem" { - type = "string" - description = "The Aggregated API Server CA key in PEM format." -} - -variable "kube_ca_cert_pem" { - type = "string" - description = "The Kubernetes CA in PEM format." -} - -variable "kube_ca_key_pem" { - type = "string" - description = "The Kubernetes CA key in PEM format." -} - -variable "service_serving_ca_cert_pem" { - type = "string" - description = "The Service Serving CA in PEM format." -} - -variable "service_serving_ca_key_pem" { - type = "string" - description = "The Service Serving CA key in PEM format." -} - -variable "admin_cert_pem" { - type = "string" - description = "The admin certificate in PEM format." -} - -variable "admin_key_pem" { - type = "string" - description = "The admin key in PEM format." -} - -variable "kubelet_cert_pem" { - type = "string" - description = "The kubelet certificate in PEM format." -} - -variable "kubelet_key_pem" { - type = "string" - description = "The kubelet key in PEM format." -} - -variable "tnc_cert_pem" { - type = "string" -} - -variable "tnc_key_pem" { - type = "string" -} - -variable "oidc_ca_cert" { - type = "string" -} - -variable "service_cidr" { - description = "A CIDR notation IP range from which to assign service cluster IPs" - type = "string" -} - -variable "pull_secret_path" { - type = "string" - description = "Path on disk to your Tectonic pull secret. Obtain this from your Tectonic Account: https://account.coreos.com." - default = "/Users/coreos/Desktop/config.json" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%variables.tf-277 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%variables.tf-277 deleted file mode 100644 index 0a02d2ea2..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootkube%variables.tf-277 +++ /dev/null @@ -1,179 +0,0 @@ -variable "advertise_address" { - description = "The IP address on which to advertise the apiserver to members of the cluster" - type = "string" -} - -variable "anonymous_auth" { - description = "Enables anonymous requests to the secure port of the API server" - type = "string" -} - -variable "apiserver_cert_pem" { - type = "string" - description = "The API server certificate in PEM format." -} - -variable "apiserver_key_pem" { - type = "string" - description = "The API server key in PEM format." -} - -variable "cloud_provider" { - description = "The provider for cloud services (empty string for no provider)" - type = "string" -} - -variable "cloud_provider_config" { - description = "Content of cloud provider config" - type = "string" - default = "" -} - -variable "cluster_cidr" { - description = "A CIDR notation IP range from which to assign pod IPs" - type = "string" -} - -variable "cluster_name" { - type = "string" -} - -variable "container_images" { - description = "Container images to use" - type = "map" -} - -variable "etcd_tls_enabled" { - default = true -} - -variable "etcd_ca_cert_pem" { - type = "string" - description = "The etcd CA certificate in PEM format." -} - -variable "etcd_client_cert_pem" { - type = "string" - description = "The etcd client certificate in PEM format." -} - -variable "etcd_client_key_pem" { - type = "string" - description = "The etcd client key in PEM format." -} - -variable "etcd_endpoints" { - description = "List of etcd endpoints to connect with (hostnames/IPs only)" - type = "list" -} - -variable "etcd_peer_cert_pem" { - type = "string" - description = "The etcd peer certificate in PEM format." -} - -variable "etcd_peer_key_pem" { - type = "string" - description = "The etcd peer key in PEM format." -} - -variable "etcd_server_cert_pem" { - type = "string" - description = "The etcd server certificate in PEM format." -} - -variable "etcd_server_key_pem" { - type = "string" - description = "The etcd server key in PEM format." -} - -variable "self_hosted_etcd" { - type = "string" - description = "See tectonic_self_hosted_etcd in config.tf" -} - -variable "kube_apiserver_url" { - description = "URL used to reach kube-apiserver" - type = "string" -} - -variable "kube_ca_cert_pem" { - type = "string" - description = "The Kubernetes CA in PEM format." -} - -variable "kubelet_cert_pem" { - type = "string" - description = "The kubelet certificate in PEM format." -} - -variable "kubelet_key_pem" { - type = "string" - description = "The kubelet key in PEM format." -} - -variable "master_count" { - description = "The number of the master nodes" - type = "string" -} - -variable "node_monitor_grace_period" { - description = "Amount of time which we allow running Node to be unresponsive before marking it unhealthy. Must be N times more than kubelet's nodeStatusUpdateFrequency, where N means number of retries allowed for kubelet to post node status. N must be stricly > 1." - type = "string" - default = "40s" -} - -variable "oidc_ca_cert" { - type = "string" -} - -variable "oidc_client_id" { - description = "The client ID for the OpenID Connect client" - type = "string" -} - -variable "oidc_groups_claim" { - description = "The OpenID claim to use for specifying user groups (string or array of strings)" - type = "string" -} - -variable "oidc_issuer_url" { - description = "The URL of the OpenID issuer, only HTTPS scheme will be accepted" - type = "string" -} - -variable "oidc_username_claim" { - description = "The OpenID claim to use as the user name" - type = "string" -} - -variable "pod_eviction_timeout" { - description = "The grace period for deleting pods on failed nodes. The eviction process will start after node_monitor_grace_period + pod_eviction_timeout." - type = "string" - default = "5m" -} - -variable "cloud_config_path" { - description = "The path to the secret file that contains the cloud config contents. Either be empty ('') or ('/etc/kubernetes/cloud/config')." - type = "string" -} - -variable "etcd_backup_size" { - type = "string" - description = "The size of the PersistentVolume used to handle etcd backups" -} - -variable "etcd_backup_storage_class" { - type = "string" - description = "The name of the Kubernetes StorageClass that will be used to handle etcd backups" -} - -variable "service_cidr" { - description = "A CIDR notation IP range from which to assign service cluster IPs" - type = "string" -} - -variable "versions" { - description = "Container versions to use" - type = "map" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootstrap-ssh%main.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootstrap-ssh%main.tf deleted file mode 100644 index 00cc9a235..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootstrap-ssh%main.tf +++ /dev/null @@ -1,28 +0,0 @@ -resource "null_resource" "bootstrapper" { - triggers { - endpoint = "${var.bootstrapping_host}" - dependencies = "${join("", concat(flatten(var._dependencies)))}" - } - - connection { - host = "${var.bootstrapping_host}" - user = "core" - agent = true - } - - provisioner "file" { - when = "create" - source = "./generated" - destination = "$HOME/tectonic" - } - - provisioner "remote-exec" { - when = "create" - - inline = [ - "sudo mkdir -p /opt", - "sudo rm -rf /opt/tectonic", - "sudo mv /home/core/tectonic /opt/", - ] - } -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootstrap-ssh%variables.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootstrap-ssh%variables.tf deleted file mode 100644 index ceb8fee13..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%bootstrap-ssh%variables.tf +++ /dev/null @@ -1,7 +0,0 @@ -variable "bootstrapping_host" { - type = "string" -} - -variable "_dependencies" { - type = "list" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%main.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%main.tf deleted file mode 100644 index b99598795..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%main.tf +++ /dev/null @@ -1,4 +0,0 @@ -data "external" "version" { - count = "${var.release_version == "latest" ? 1 : 0}" - program = ["sh", "-c", "curl https://${var.release_channel}.release.core-os.net/amd64-usr/current/version.txt | sed -n 's/COREOS_VERSION=\\(.*\\)$/{\"version\": \"\\1\"}/p'"] -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%main.tf-236 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%main.tf-236 deleted file mode 100644 index 4e662cba3..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%main.tf-236 +++ /dev/null @@ -1,3 +0,0 @@ -data "external" "version" { - program = ["sh", "-c", "curl https://${var.release_channel}.release.core-os.net/amd64-usr/current/version.txt | sed -n 's/COREOS_VERSION=\\(.*\\)$/{\"version\": \"\\1\"}/p'"] -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%outputs.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%outputs.tf deleted file mode 100644 index 8d9df4a40..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%outputs.tf +++ /dev/null @@ -1,13 +0,0 @@ -locals { - // Create a map that matches the structure of the output of the external data source - // so we can avoid running the shell script and still parse the output consistently. - // Here, we jsonencode because ternaries can only operate on flat data types and - // Terraform `merge` and `element` do not play nicely with maps. - json = "${var.release_version == "latest" ? jsonencode(data.external.version.*.result) : jsonencode(map("version", var.release_version))}" -} - -output "version" { - // Parse out the version from the well-known JSON of format: - // {"version":""} - value = "${replace(local.json, "/.*\"version\":\"(.*)\".*/", "$1")}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%outputs.tf-204 b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%outputs.tf-204 deleted file mode 100644 index 7805bef88..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%outputs.tf-204 +++ /dev/null @@ -1,3 +0,0 @@ -output "version" { - value = "${var.release_version == "latest" ? data.external.version.result["version"] : var.release_version}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%variables.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%variables.tf deleted file mode 100644 index 48a2493ed..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%modules%container_linux%variables.tf +++ /dev/null @@ -1,19 +0,0 @@ -variable "release_channel" { - type = "string" - - description = < 0 ? - join("|", keys(var.tectonic_aws_master_custom_subnets)) : - join("|", data.aws_availability_zones.azs.names) - )}" - worker_azs = "${ split("|", "${length(keys(var.tectonic_aws_worker_custom_subnets))}" > 0 ? - join("|", keys(var.tectonic_aws_worker_custom_subnets)) : - join("|", data.aws_availability_zones.azs.names) - )}" -} - -module "etcd" { - source = "../../modules/aws/etcd" - - base_domain = "${var.tectonic_base_domain}" - cluster_id = "${module.tectonic.cluster_id}" - cluster_name = "${var.tectonic_cluster_name}" - container_image = "${var.tectonic_container_images["etcd"]}" - container_linux_channel = "${var.tectonic_container_linux_channel}" - container_linux_version = "${module.container_linux.version}" - ec2_ami = "${var.tectonic_aws_ec2_ami_override}" - ec2_type = "${var.tectonic_aws_etcd_ec2_type}" - etcd_iam_role = "${var.tectonic_aws_etcd_iam_role_name}" - external_endpoints = "${compact(var.tectonic_etcd_servers)}" - extra_tags = "${var.tectonic_aws_extra_tags}" - ign_etcd_crt_id_list = "${module.ignition_masters.etcd_crt_id_list}" - ign_etcd_dropin_id_list = "${module.ignition_masters.etcd_dropin_id_list}" - ign_ntp_dropin_id = "${length(var.tectonic_ntp_servers) > 0 ? module.ignition_masters.ntp_dropin_id : ""}" - ign_profile_env_id = "${module.ignition_masters.profile_env_id}" - ign_systemd_default_env_id = "${module.ignition_masters.systemd_default_env_id}" - instance_count = "${length(data.template_file.etcd_hostname_list.*.id)}" - root_volume_iops = "${var.tectonic_aws_etcd_root_volume_iops}" - root_volume_size = "${var.tectonic_aws_etcd_root_volume_size}" - root_volume_type = "${var.tectonic_aws_etcd_root_volume_type}" - s3_bucket = "${aws_s3_bucket.tectonic.bucket}" - sg_ids = "${concat(var.tectonic_aws_etcd_extra_sg_ids, list(module.vpc.etcd_sg_id))}" - ssh_key = "${var.tectonic_aws_ssh_key}" - subnets = "${module.vpc.worker_subnet_ids}" - tls_enabled = "${var.tectonic_etcd_tls_enabled}" -} - -module "ignition_masters" { - source = "../../modules/ignition" - - assets_location = "${aws_s3_bucket_object.tectonic_assets.bucket}/${aws_s3_bucket_object.tectonic_assets.key}" - base_domain = "${var.tectonic_base_domain}" - bootstrap_upgrade_cl = "${var.tectonic_bootstrap_upgrade_cl}" - cloud_provider = "aws" - cluster_name = "${var.tectonic_cluster_name}" - container_images = "${var.tectonic_container_images}" - custom_ca_cert_pem_list = "${var.tectonic_custom_ca_pem_list}" - etcd_advertise_name_list = "${data.template_file.etcd_hostname_list.*.rendered}" - etcd_ca_cert_pem = "${module.etcd_certs.etcd_ca_crt_pem}" - etcd_client_crt_pem = "${module.etcd_certs.etcd_client_crt_pem}" - etcd_client_key_pem = "${module.etcd_certs.etcd_client_key_pem}" - etcd_count = "${length(data.template_file.etcd_hostname_list.*.id)}" - etcd_initial_cluster_list = "${data.template_file.etcd_hostname_list.*.rendered}" - etcd_peer_crt_pem = "${module.etcd_certs.etcd_peer_crt_pem}" - etcd_peer_key_pem = "${module.etcd_certs.etcd_peer_key_pem}" - etcd_server_crt_pem = "${module.etcd_certs.etcd_server_crt_pem}" - etcd_server_key_pem = "${module.etcd_certs.etcd_server_key_pem}" - etcd_tls_enabled = "${var.tectonic_etcd_tls_enabled}" - http_proxy = "${var.tectonic_http_proxy_address}" - http_proxy_enabled = "${local.tectonic_http_proxy_enabled}" - https_proxy = "${var.tectonic_https_proxy_address}" - image_re = "${var.tectonic_image_re}" - ingress_ca_cert_pem = "${module.ingress_certs.ca_cert_pem}" - iscsi_enabled = "${var.tectonic_iscsi_enabled}" - kube_ca_cert_pem = "${module.kube_certs.ca_cert_pem}" - kube_dns_service_ip = "${module.bootkube.kube_dns_service_ip}" - kubeconfig_fetch_cmd = "/opt/s3-puller.sh ${aws_s3_bucket_object.kubeconfig.bucket}/${aws_s3_bucket_object.kubeconfig.key} /etc/kubernetes/kubeconfig" - kubelet_cni_bin_dir = "${var.tectonic_networking == "calico" || var.tectonic_networking == "canal" ? "/var/lib/cni/bin" : "" }" - kubelet_debug_config = "${var.tectonic_kubelet_debug_config}" - kubelet_node_label = "node-role.kubernetes.io/master" - kubelet_node_taints = "node-role.kubernetes.io/master=:NoSchedule" - nfs_config_file = "${local._tectonic_nfs_config_file}" - no_proxy = "${var.tectonic_no_proxy}" - ntp_servers = "${var.tectonic_ntp_servers}" - proxy_exclusive_units = "${var.tectonic_proxy_exclusive_units}" - tectonic_vanilla_k8s = "${var.tectonic_vanilla_k8s}" -} - -module "masters" { - source = "../../modules/aws/master-asg" - - assets_s3_location = "${aws_s3_bucket_object.tectonic_assets.bucket}/${aws_s3_bucket_object.tectonic_assets.key}" - autoscaling_group_extra_tags = "${var.tectonic_autoscaling_group_extra_tags}" - aws_lbs = "${module.vpc.aws_lbs}" - base_domain = "${var.tectonic_base_domain}" - cluster_id = "${module.tectonic.cluster_id}" - cluster_name = "${var.tectonic_cluster_name}" - container_images = "${var.tectonic_container_images}" - container_linux_channel = "${var.tectonic_container_linux_channel}" - container_linux_version = "${module.container_linux.version}" - ec2_ami = "${var.tectonic_aws_ec2_ami_override}" - ec2_type = "${var.tectonic_aws_master_ec2_type}" - extra_tags = "${var.tectonic_aws_extra_tags}" - ign_bootkube_path_unit_id = "${module.bootkube.systemd_path_unit_id}" - ign_bootkube_service_id = "${module.bootkube.systemd_service_id}" - ign_ca_cert_id_list = "${module.ignition_masters.ca_cert_id_list}" - ign_docker_dropin_id = "${module.ignition_masters.docker_dropin_id}" - ign_init_assets_service_id = "${module.ignition_masters.init_assets_service_id}" - ign_installer_kubelet_env_id = "${module.ignition_masters.installer_kubelet_env_id}" - ign_installer_runtime_mappings_id = "${module.ignition_masters.installer_runtime_mappings_id}" - ign_iscsi_service_id = "${module.ignition_masters.iscsi_service_id}" - ign_k8s_node_bootstrap_service_id = "${module.ignition_masters.k8s_node_bootstrap_service_id}" - ign_kubelet_service_id = "${module.ignition_masters.kubelet_service_id}" - ign_locksmithd_service_id = "${module.ignition_masters.locksmithd_service_id}" - ign_max_user_watches_id = "${module.ignition_masters.max_user_watches_id}" - ign_nfs_config_id = "${var.tectonic_nfs_config_file != "" ? module.ignition_masters.nfs_config_id : ""}" - ign_ntp_dropin_id = "${length(var.tectonic_ntp_servers) > 0 ? module.ignition_masters.ntp_dropin_id : ""}" - ign_profile_env_id = "${module.ignition_masters.profile_env_id}" - ign_rm_assets_path_unit_id = "${module.ignition_masters.rm_assets_path_unit_id}" - ign_rm_assets_service_id = "${module.ignition_masters.rm_assets_service_id}" - ign_s3_puller_id = "${module.ignition_masters.s3_puller_id}" - ign_systemd_default_env_id = "${module.ignition_masters.systemd_default_env_id}" - ign_tectonic_path_unit_id = "${var.tectonic_vanilla_k8s ? "" : module.tectonic.systemd_path_unit_id}" - ign_tectonic_service_id = "${module.tectonic.systemd_service_id}" - ign_update_ca_certificates_dropin_id = "${module.ignition_masters.update_ca_certificates_dropin_id}" - instance_count = "${var.tectonic_master_count}" - master_iam_role = "${var.tectonic_aws_master_iam_role_name}" - master_sg_ids = "${concat(var.tectonic_aws_master_extra_sg_ids, list(module.vpc.master_sg_id))}" - private_endpoints = "${var.tectonic_aws_private_endpoints}" - public_endpoints = "${var.tectonic_aws_public_endpoints}" - root_volume_iops = "${var.tectonic_aws_master_root_volume_iops}" - root_volume_size = "${var.tectonic_aws_master_root_volume_size}" - root_volume_type = "${var.tectonic_aws_master_root_volume_type}" - s3_bucket = "${aws_s3_bucket.tectonic.bucket}" - ssh_key = "${var.tectonic_aws_ssh_key}" - subnet_ids = "${module.vpc.master_subnet_ids}" -} - -module "ignition_workers" { - source = "../../modules/ignition" - - bootstrap_upgrade_cl = "${var.tectonic_bootstrap_upgrade_cl}" - cloud_provider = "aws" - container_images = "${var.tectonic_container_images}" - custom_ca_cert_pem_list = "${var.tectonic_custom_ca_pem_list}" - etcd_ca_cert_pem = "${module.etcd_certs.etcd_ca_crt_pem}" - http_proxy = "${var.tectonic_http_proxy_address}" - http_proxy_enabled = "${local.tectonic_http_proxy_enabled}" - https_proxy = "${var.tectonic_https_proxy_address}" - image_re = "${var.tectonic_image_re}" - ingress_ca_cert_pem = "${module.ingress_certs.ca_cert_pem}" - iscsi_enabled = "${var.tectonic_iscsi_enabled}" - kube_ca_cert_pem = "${module.kube_certs.ca_cert_pem}" - kube_dns_service_ip = "${module.bootkube.kube_dns_service_ip}" - kubeconfig_fetch_cmd = "/opt/s3-puller.sh ${aws_s3_bucket_object.kubeconfig.bucket}/${aws_s3_bucket_object.kubeconfig.key} /etc/kubernetes/kubeconfig" - kubelet_cni_bin_dir = "${var.tectonic_networking == "calico" || var.tectonic_networking == "canal" ? "/var/lib/cni/bin" : "" }" - kubelet_debug_config = "${var.tectonic_kubelet_debug_config}" - kubelet_node_label = "node-role.kubernetes.io/node" - kubelet_node_taints = "" - nfs_config_file = "${local._tectonic_nfs_config_file}" - no_proxy = "${var.tectonic_no_proxy}" - ntp_servers = "${var.tectonic_ntp_servers}" - proxy_exclusive_units = "${var.tectonic_proxy_exclusive_units}" - tectonic_vanilla_k8s = "${var.tectonic_vanilla_k8s}" -} - -module "workers" { - source = "../../modules/aws/worker-asg" - - autoscaling_group_extra_tags = "${var.tectonic_autoscaling_group_extra_tags}" - cluster_id = "${module.tectonic.cluster_id}" - cluster_name = "${var.tectonic_cluster_name}" - container_linux_channel = "${var.tectonic_container_linux_channel}" - container_linux_version = "${module.container_linux.version}" - ec2_ami = "${var.tectonic_aws_ec2_ami_override}" - ec2_type = "${var.tectonic_aws_worker_ec2_type}" - extra_tags = "${var.tectonic_aws_extra_tags}" - ign_ca_cert_id_list = "${module.ignition_masters.ca_cert_id_list}" - ign_docker_dropin_id = "${module.ignition_workers.docker_dropin_id}" - ign_installer_kubelet_env_id = "${module.ignition_workers.installer_kubelet_env_id}" - ign_installer_runtime_mappings_id = "${module.ignition_workers.installer_runtime_mappings_id}" - ign_iscsi_service_id = "${module.ignition_workers.iscsi_service_id}" - ign_k8s_node_bootstrap_service_id = "${module.ignition_workers.k8s_node_bootstrap_service_id}" - ign_kubelet_service_id = "${module.ignition_workers.kubelet_service_id}" - ign_locksmithd_service_id = "${module.ignition_workers.locksmithd_service_id}" - ign_max_user_watches_id = "${module.ignition_workers.max_user_watches_id}" - ign_nfs_config_id = "${var.tectonic_nfs_config_file != "" ? module.ignition_workers.nfs_config_id : ""}" - ign_ntp_dropin_id = "${length(var.tectonic_ntp_servers) > 0 ? module.ignition_workers.ntp_dropin_id : ""}" - ign_profile_env_id = "${module.ignition_workers.profile_env_id}" - ign_s3_puller_id = "${module.ignition_workers.s3_puller_id}" - ign_systemd_default_env_id = "${module.ignition_workers.systemd_default_env_id}" - ign_update_ca_certificates_dropin_id = "${module.ignition_workers.update_ca_certificates_dropin_id}" - instance_count = "${var.tectonic_worker_count}" - load_balancers = "${var.tectonic_aws_worker_load_balancers}" - root_volume_iops = "${var.tectonic_aws_worker_root_volume_iops}" - root_volume_size = "${var.tectonic_aws_worker_root_volume_size}" - root_volume_type = "${var.tectonic_aws_worker_root_volume_type}" - s3_bucket = "${aws_s3_bucket.tectonic.bucket}" - sg_ids = "${concat(var.tectonic_aws_worker_extra_sg_ids, list(module.vpc.worker_sg_id))}" - ssh_key = "${var.tectonic_aws_ssh_key}" - subnet_ids = "${module.vpc.worker_subnet_ids}" - vpc_id = "${module.vpc.vpc_id}" - worker_iam_role = "${var.tectonic_aws_worker_iam_role_name}" -} - -module "dns" { - source = "../../modules/dns/route53" - - api_external_elb_dns_name = "${module.vpc.aws_api_external_dns_name}" - api_external_elb_zone_id = "${module.vpc.aws_elb_api_external_zone_id}" - api_internal_elb_dns_name = "${module.vpc.aws_api_internal_dns_name}" - api_internal_elb_zone_id = "${module.vpc.aws_elb_api_internal_zone_id}" - api_ip_addresses = "${module.vpc.aws_lbs}" - base_domain = "${var.tectonic_base_domain}" - cluster_id = "${module.tectonic.cluster_id}" - cluster_name = "${var.tectonic_cluster_name}" - console_elb_dns_name = "${module.vpc.aws_console_dns_name}" - console_elb_zone_id = "${module.vpc.aws_elb_console_zone_id}" - custom_dns_name = "${var.tectonic_dns_name}" - elb_alias_enabled = true - etcd_count = "${length(data.template_file.etcd_hostname_list.*.id)}" - etcd_ip_addresses = "${module.etcd.ip_addresses}" - external_endpoints = ["${compact(var.tectonic_etcd_servers)}"] - master_count = "${var.tectonic_master_count}" - tectonic_external_private_zone = "${var.tectonic_aws_external_private_zone}" - tectonic_external_vpc_id = "${module.vpc.vpc_id}" - tectonic_extra_tags = "${var.tectonic_aws_extra_tags}" - tectonic_private_endpoints = "${var.tectonic_aws_private_endpoints}" - tectonic_public_endpoints = "${var.tectonic_aws_public_endpoints}" - tectonic_vanilla_k8s = "${var.tectonic_vanilla_k8s}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%tectonic.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%tectonic.tf deleted file mode 100644 index dd093f1ca..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%tectonic.tf +++ /dev/null @@ -1,160 +0,0 @@ -data "template_file" "etcd_hostname_list" { - count = "${var.tectonic_self_hosted_etcd != "" ? 0 : var.tectonic_etcd_count > 0 ? var.tectonic_etcd_count : length(data.aws_availability_zones.azs.names) == 5 ? 5 : 3}" - template = "${var.tectonic_cluster_name}-etcd-${count.index}.${var.tectonic_base_domain}" -} - -module "bootkube" { - source = "../../modules/bootkube" - cloud_provider = "aws" - - cluster_name = "${var.tectonic_cluster_name}" - - kube_apiserver_url = "https://${var.tectonic_aws_private_endpoints ? module.dns.api_internal_fqdn : module.dns.api_external_fqdn}:443" - oidc_issuer_url = "https://${var.tectonic_aws_private_endpoints ? module.dns.ingress_internal_fqdn : module.dns.ingress_external_fqdn}/identity" - - # Platform-independent variables wiring, do not modify. - container_images = "${var.tectonic_container_images}" - versions = "${var.tectonic_versions}" - self_hosted_etcd = "${var.tectonic_self_hosted_etcd}" - - service_cidr = "${var.tectonic_service_cidr}" - cluster_cidr = "${var.tectonic_cluster_cidr}" - - advertise_address = "0.0.0.0" - anonymous_auth = "false" - - oidc_username_claim = "email" - oidc_groups_claim = "groups" - oidc_client_id = "tectonic-kubectl" - oidc_ca_cert = "${module.ingress_certs.ca_cert_pem}" - - apiserver_cert_pem = "${module.kube_certs.apiserver_cert_pem}" - apiserver_key_pem = "${module.kube_certs.apiserver_key_pem}" - etcd_ca_cert_pem = "${module.etcd_certs.etcd_ca_crt_pem}" - etcd_client_cert_pem = "${module.etcd_certs.etcd_client_crt_pem}" - etcd_client_key_pem = "${module.etcd_certs.etcd_client_key_pem}" - etcd_peer_cert_pem = "${module.etcd_certs.etcd_peer_crt_pem}" - etcd_peer_key_pem = "${module.etcd_certs.etcd_peer_key_pem}" - etcd_server_cert_pem = "${module.etcd_certs.etcd_server_crt_pem}" - etcd_server_key_pem = "${module.etcd_certs.etcd_server_key_pem}" - kube_ca_cert_pem = "${module.kube_certs.ca_cert_pem}" - kubelet_cert_pem = "${module.kube_certs.kubelet_cert_pem}" - kubelet_key_pem = "${module.kube_certs.kubelet_key_pem}" - - etcd_backup_size = "${var.tectonic_etcd_backup_size}" - etcd_backup_storage_class = "${var.tectonic_etcd_backup_storage_class}" - etcd_endpoints = "${module.dns.etcd_endpoints}" - master_count = "${var.tectonic_master_count}" - - # The default behavior of Kubernetes's controller manager is to mark a node - # as Unhealthy after 40s without an update from the node's kubelet. However, - # AWS ELB's Route53 records have a fixed TTL of 60s. Therefore, when an ELB's - # node disappears (e.g. scaled down or crashed), kubelet might fail to report - # for a period of time that exceed the default grace period of 40s and the - # node might become Unhealthy. While the eviction process won't start until - # the pod_eviction_timeout is reached, 5min by default, certain operators - # might already have taken action. This is the case for the etcd operator as - # of v0.3.3, which removes the likely-healthy etcd pods from the the - # cluster, potentially leading to a loss-of-quorum as generally all kubelets - # are affected simultaneously. - # - # To cope with this issue, we increase the grace period, and reduce the - # pod eviction time-out accordingly so pods still get evicted after an total - # time of 340s after the first post-status failure. - # - # Ref: https://github.com/kubernetes/kubernetes/issues/41916 - # Ref: https://github.com/kubernetes-incubator/kube-aws/issues/598 - node_monitor_grace_period = "2m" - - pod_eviction_timeout = "220s" - - cloud_config_path = "" -} - -module "tectonic" { - source = "../../modules/tectonic" - platform = "aws" - - cluster_name = "${var.tectonic_cluster_name}" - - base_address = "${var.tectonic_aws_private_endpoints ? module.dns.ingress_internal_fqdn : module.dns.ingress_external_fqdn}" - kube_apiserver_url = "https://${var.tectonic_aws_private_endpoints ? module.dns.api_internal_fqdn : module.dns.api_external_fqdn}:443" - service_cidr = "${var.tectonic_service_cidr}" - - # Platform-independent variables wiring, do not modify. - container_images = "${var.tectonic_container_images}" - container_base_images = "${var.tectonic_container_base_images}" - versions = "${var.tectonic_versions}" - - license_path = "${var.tectonic_vanilla_k8s ? "/dev/null" : pathexpand(var.tectonic_license_path)}" - pull_secret_path = "${var.tectonic_vanilla_k8s ? "/dev/null" : pathexpand(var.tectonic_pull_secret_path)}" - - admin_email = "${var.tectonic_admin_email}" - admin_password = "${var.tectonic_admin_password}" - - update_channel = "${var.tectonic_update_channel}" - update_app_id = "${var.tectonic_update_app_id}" - update_server = "${var.tectonic_update_server}" - - ca_generated = "${var.tectonic_ca_cert == "" ? false : true}" - ca_cert = "${module.kube_certs.ca_cert_pem}" - - ingress_ca_cert_pem = "${module.ingress_certs.ca_cert_pem}" - ingress_cert_pem = "${module.ingress_certs.cert_pem}" - ingress_key_pem = "${module.ingress_certs.key_pem}" - - identity_client_cert_pem = "${module.identity_certs.client_cert_pem}" - identity_client_key_pem = "${module.identity_certs.client_key_pem}" - identity_server_cert_pem = "${module.identity_certs.server_cert_pem}" - identity_server_key_pem = "${module.identity_certs.server_key_pem}" - - console_client_id = "tectonic-console" - kubectl_client_id = "tectonic-kubectl" - ingress_kind = "NodePort" - self_hosted_etcd = "${var.tectonic_self_hosted_etcd}" - master_count = "${var.tectonic_master_count}" - stats_url = "${var.tectonic_stats_url}" - - image_re = "${var.tectonic_image_re}" -} - -module "flannel_vxlan" { - source = "../../modules/net/flannel_vxlan" - - cluster_cidr = "${var.tectonic_cluster_cidr}" - enabled = "${var.tectonic_networking == "flannel"}" - container_images = "${var.tectonic_container_images}" -} - -module "calico" { - source = "../../modules/net/calico" - - container_images = "${var.tectonic_container_images}" - cluster_cidr = "${var.tectonic_cluster_cidr}" - enabled = "${var.tectonic_networking == "calico"}" -} - -module "canal" { - source = "../../modules/net/canal" - - container_images = "${var.tectonic_container_images}" - cluster_cidr = "${var.tectonic_cluster_cidr}" - enabled = "${var.tectonic_networking == "canal"}" -} - -data "archive_file" "assets" { - type = "zip" - source_dir = "./generated/" - - # Because the archive_file provider is a data source, depends_on can't be - # used to guarantee that the tectonic/bootkube modules have generated - # all the assets on disk before trying to archive them. Instead, we use their - # ID outputs, that are only computed once the assets have actually been - # written to disk. We re-hash the IDs (or dedicated module outputs, like module.bootkube.content_hash) - # to make the filename shorter, since there is no security nor collision risk anyways. - # - # Additionally, data sources do not support managing any lifecycle whatsoever, - # and therefore, the archive is never deleted. To avoid cluttering the module - # folder, we write it in the Terraform managed hidden folder `.terraform`. - output_path = "./.terraform/generated_${sha1("${module.etcd_certs.id} ${module.tectonic.id} ${module.bootkube.id} ${module.flannel_vxlan.id} ${module.calico.id} ${module.canal.id}")}.zip" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%tls.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%tls.tf deleted file mode 100644 index c33902e23..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%tls.tf +++ /dev/null @@ -1,40 +0,0 @@ -module "kube_certs" { - source = "../../modules/tls/kube/self-signed" - - ca_cert_pem = "${var.tectonic_ca_cert}" - ca_key_alg = "${var.tectonic_ca_key_alg}" - ca_key_pem = "${var.tectonic_ca_key}" - kube_apiserver_url = "https://${var.tectonic_aws_private_endpoints ? module.dns.api_internal_fqdn : module.dns.api_external_fqdn}:443" - service_cidr = "${var.tectonic_service_cidr}" - validity_period = "${var.tectonic_tls_validity_period}" -} - -module "etcd_certs" { - source = "../../modules/tls/etcd/signed" - - etcd_ca_cert_path = "${var.tectonic_etcd_ca_cert_path}" - etcd_cert_dns_names = "${data.template_file.etcd_hostname_list.*.rendered}" - etcd_client_cert_path = "${var.tectonic_etcd_client_cert_path}" - etcd_client_key_path = "${var.tectonic_etcd_client_key_path}" - self_signed = "${var.tectonic_self_hosted_etcd != "" ? "true" : length(compact(var.tectonic_etcd_servers)) == 0 ? "true" : "false"}" - service_cidr = "${var.tectonic_service_cidr}" -} - -module "ingress_certs" { - source = "../../modules/tls/ingress/self-signed" - - base_address = "${var.tectonic_aws_private_endpoints ? module.dns.ingress_internal_fqdn : module.dns.ingress_external_fqdn}" - ca_cert_pem = "${module.kube_certs.ca_cert_pem}" - ca_key_alg = "${module.kube_certs.ca_key_alg}" - ca_key_pem = "${module.kube_certs.ca_key_pem}" - validity_period = "${var.tectonic_tls_validity_period}" -} - -module "identity_certs" { - source = "../../modules/tls/identity/self-signed" - - ca_cert_pem = "${module.kube_certs.ca_cert_pem}" - ca_key_alg = "${module.kube_certs.ca_key_alg}" - ca_key_pem = "${module.kube_certs.ca_key_pem}" - validity_period = "${var.tectonic_tls_validity_period}" -} diff --git a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%variables.tf b/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%variables.tf deleted file mode 100644 index 0dbec6473..000000000 --- a/vendored_parsers/tree-sitter-hcl/example/real_world_stuff/coreos/coreos%tectonic-installer%platforms%aws%variables.tf +++ /dev/null @@ -1,347 +0,0 @@ -variable "tectonic_aws_config_version" { - description = <,%,&,\,?,/' or control characters. -EOF - - default = {} -} - -variable "tectonic_azure_private_cluster" { - description = <