terraform

command module
v0.0.0-...-6b6b0cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README

Terraform Provider Plugin

Usage

Please, refer to official documentation.

Development

  1. Install protobuf.

  2. Install protoc-gen-terraform @v3.0.2.

    go install github.com/gravitational/protoc-gen-terraform/v3@v3.0.2

  3. Install Terraform v1.1.0+. Alternatively, you can use tfenv. Please note that on Mac M1 you need to specify TFENV_ARCH (ex: TFENV_ARCH=arm64 tfenv install 1.1.6).

  4. Build and install the plugin:

    cd integrations/terraform
    make install
    
  5. Run tests:

    make test
    

Updating the provider

Run:

make gen-tfschema

This will generate types_tfschema.go from a current API .proto file, and regenerate the provider code.

If the schema changed, you will need to re-render the docs with:

make docs

Playing with examples locally

  1. Start Teleport.

    teleport start
    
  2. Create Terraform user and role:

    tctl create example/terraform.yaml
    tctl auth sign --format=file --user=terraform --out=/tmp/terraform-identity --ttl=10h
    
  3. Create main.tf file:

    cp example/main.tf.example example/main.tf
    

    Please note that target identity file was exported to /tmp/terraform-identity on previous step. If you used another location, please change in in main.tf.

  4. Create sample resources:

    cp example/user.tf.example example/user.tf
    cp example/role.tf.example example/role.tf
    cp example/provision_token.tf.example example/provision_token.tf
    

    Please note that some resources require preliminary setup steps.

  5. Apply changes:

    make apply
    
  6. Make changes to .tf files and run:

    make reapply
    
  7. Clean up:

    make destroy
    

Documentation

Overview

Copyright 2015-2022 Gravitational, Inc.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL