diff --git a/.copywrite.hcl b/.copywrite.hcl index 454a0c04bd..4b4d238cc4 100644 --- a/.copywrite.hcl +++ b/.copywrite.hcl @@ -13,6 +13,9 @@ project { # files or folders should be ignored header_ignore = [ "**/*.tf", + "**/*.tftest.hcl", + "testing/equivalence-tests/**/.terraform.lock.hcl", + "website/docs/**/examples/**", "**/testdata/**", "**/*.pb.go", "**/*_string.go", diff --git a/.github/scripts/update_top_issues_ranking/main.go b/.github/scripts/update_top_issues_ranking/main.go index c1fb87cd4f..476f7f03ae 100644 --- a/.github/scripts/update_top_issues_ranking/main.go +++ b/.github/scripts/update_top_issues_ranking/main.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package main import ( diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 462234ee69..86633d0ecd 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -214,6 +214,14 @@ jobs: with: version: v1.58 only-new-issues: true + + - name: "Copyright headers" + run: | + go run github.com/hashicorp/copywrite headers --plan + if [[ $? != 0 ]]; then + echo >&2 "ERROR: some files are missing required copyright headers. Run `scripts/add-copyright-headers.sh` locally and then commit the updated files." + exit 1 + fi license-checks: name: "License Checks" diff --git a/.golangci.yml b/.golangci.yml index d186c50cdb..2d86f7a61b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,3 +1,8 @@ +# Copyright (c) The OpenTofu Authors +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2023 HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + run: timeout: 30m diff --git a/copyright_headers.go b/copyright_headers.go deleted file mode 100644 index 13bd51c647..0000000000 --- a/copyright_headers.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) The OpenTofu Authors -// SPDX-License-Identifier: MPL-2.0 -// Copyright (c) 2023 HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -//go:build tools -// +build tools - -package main - -import ( - _ "github.com/hashicorp/copywrite" -) - -//go:generate go run github.com/hashicorp/copywrite headers diff --git a/internal/addrs/provider_function.go b/internal/addrs/provider_function.go index 83d4ac9f6c..619f3b766a 100644 --- a/internal/addrs/provider_function.go +++ b/internal/addrs/provider_function.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package addrs import ( diff --git a/internal/collections/set.go b/internal/collections/set.go index 83ac2a0f37..0719df9db5 100644 --- a/internal/collections/set.go +++ b/internal/collections/set.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package collections import ( diff --git a/internal/collections/set_test.go b/internal/collections/set_test.go index d9cf178c0f..31107147fd 100644 --- a/internal/collections/set_test.go +++ b/internal/collections/set_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package collections_test import ( diff --git a/internal/command/e2etest/encryption_test.go b/internal/command/e2etest/encryption_test.go index 444fb31004..72fdf4f047 100644 --- a/internal/command/e2etest/encryption_test.go +++ b/internal/command/e2etest/encryption_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package e2etest import ( diff --git a/internal/command/e2etest/provider_functions_test.go b/internal/command/e2etest/provider_functions_test.go index 038cd691a7..1005fb9efe 100644 --- a/internal/command/e2etest/provider_functions_test.go +++ b/internal/command/e2etest/provider_functions_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package e2etest import ( diff --git a/internal/command/meta_encryption.go b/internal/command/meta_encryption.go index 6a401cbfc4..0235433be1 100644 --- a/internal/command/meta_encryption.go +++ b/internal/command/meta_encryption.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package command import ( diff --git a/internal/command/meta_ui.go b/internal/command/meta_ui.go index 0c5c7c4e56..d79e02e4ec 100644 --- a/internal/command/meta_ui.go +++ b/internal/command/meta_ui.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package command import ( diff --git a/internal/configs/hcl2shim/util_test.go b/internal/configs/hcl2shim/util_test.go index 5d75d2b54d..8ead122db3 100644 --- a/internal/configs/hcl2shim/util_test.go +++ b/internal/configs/hcl2shim/util_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package hcl2shim import ( diff --git a/internal/configs/shim.go b/internal/configs/shim.go index 327d1220aa..b9bd813587 100644 --- a/internal/configs/shim.go +++ b/internal/configs/shim.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package configs import ( diff --git a/internal/encryption/keyprovider/aws_kms/config.go b/internal/encryption/keyprovider/aws_kms/config.go index 33d79b72bd..cd5094dc85 100644 --- a/internal/encryption/keyprovider/aws_kms/config.go +++ b/internal/encryption/keyprovider/aws_kms/config.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aws_kms import ( diff --git a/internal/encryption/keyprovider/aws_kms/config_assumerole.go b/internal/encryption/keyprovider/aws_kms/config_assumerole.go index 421e51d7ca..8d006e7af2 100644 --- a/internal/encryption/keyprovider/aws_kms/config_assumerole.go +++ b/internal/encryption/keyprovider/aws_kms/config_assumerole.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aws_kms import ( diff --git a/internal/encryption/keyprovider/aws_kms/config_endpoints.go b/internal/encryption/keyprovider/aws_kms/config_endpoints.go index b24a478358..243852eb74 100644 --- a/internal/encryption/keyprovider/aws_kms/config_endpoints.go +++ b/internal/encryption/keyprovider/aws_kms/config_endpoints.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aws_kms import ( diff --git a/internal/encryption/keyprovider/aws_kms/config_test.go b/internal/encryption/keyprovider/aws_kms/config_test.go index b01c9b884a..d1f7847493 100644 --- a/internal/encryption/keyprovider/aws_kms/config_test.go +++ b/internal/encryption/keyprovider/aws_kms/config_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aws_kms import ( diff --git a/internal/encryption/keyprovider/aws_kms/descriptor.go b/internal/encryption/keyprovider/aws_kms/descriptor.go index 1ae90587ed..d8e22bb7fe 100644 --- a/internal/encryption/keyprovider/aws_kms/descriptor.go +++ b/internal/encryption/keyprovider/aws_kms/descriptor.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aws_kms import ( diff --git a/internal/encryption/keyprovider/aws_kms/provider.go b/internal/encryption/keyprovider/aws_kms/provider.go index 2cb57cc2aa..1e2273662d 100644 --- a/internal/encryption/keyprovider/aws_kms/provider.go +++ b/internal/encryption/keyprovider/aws_kms/provider.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aws_kms import ( diff --git a/internal/encryption/keyprovider/aws_kms/provider_test.go b/internal/encryption/keyprovider/aws_kms/provider_test.go index 28f6ccb275..e3b42f7b6d 100644 --- a/internal/encryption/keyprovider/aws_kms/provider_test.go +++ b/internal/encryption/keyprovider/aws_kms/provider_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aws_kms import ( diff --git a/internal/encryption/keyprovider/errors.go b/internal/encryption/keyprovider/errors.go index 96b15f1034..e82e033540 100644 --- a/internal/encryption/keyprovider/errors.go +++ b/internal/encryption/keyprovider/errors.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package keyprovider import "fmt" diff --git a/internal/encryption/keyprovider/gcp_kms/compliance_test.go b/internal/encryption/keyprovider/gcp_kms/compliance_test.go index 04c5120f96..878c0466b5 100644 --- a/internal/encryption/keyprovider/gcp_kms/compliance_test.go +++ b/internal/encryption/keyprovider/gcp_kms/compliance_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package gcp_kms import ( diff --git a/internal/encryption/keyprovider/gcp_kms/config.go b/internal/encryption/keyprovider/gcp_kms/config.go index f4c35dcac3..e2eca34228 100644 --- a/internal/encryption/keyprovider/gcp_kms/config.go +++ b/internal/encryption/keyprovider/gcp_kms/config.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package gcp_kms import ( diff --git a/internal/encryption/keyprovider/gcp_kms/descriptor.go b/internal/encryption/keyprovider/gcp_kms/descriptor.go index 2c8e34dbd6..7568b0bd1e 100644 --- a/internal/encryption/keyprovider/gcp_kms/descriptor.go +++ b/internal/encryption/keyprovider/gcp_kms/descriptor.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package gcp_kms import ( diff --git a/internal/encryption/keyprovider/gcp_kms/provider.go b/internal/encryption/keyprovider/gcp_kms/provider.go index 86e2dd9842..70b294ed09 100644 --- a/internal/encryption/keyprovider/gcp_kms/provider.go +++ b/internal/encryption/keyprovider/gcp_kms/provider.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package gcp_kms import ( diff --git a/internal/encryption/keyprovider/openbao/client.go b/internal/encryption/keyprovider/openbao/client.go index 59d7a4db08..dfaeb99b6e 100644 --- a/internal/encryption/keyprovider/openbao/client.go +++ b/internal/encryption/keyprovider/openbao/client.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package openbao import ( diff --git a/internal/encryption/keyprovider/openbao/compliance_test.go b/internal/encryption/keyprovider/openbao/compliance_test.go index 0e977a2942..e81e7aef5f 100644 --- a/internal/encryption/keyprovider/openbao/compliance_test.go +++ b/internal/encryption/keyprovider/openbao/compliance_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package openbao import ( diff --git a/internal/encryption/keyprovider/openbao/config.go b/internal/encryption/keyprovider/openbao/config.go index d3a38fc6af..bb9794b7ac 100644 --- a/internal/encryption/keyprovider/openbao/config.go +++ b/internal/encryption/keyprovider/openbao/config.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package openbao import ( diff --git a/internal/encryption/keyprovider/openbao/descriptor.go b/internal/encryption/keyprovider/openbao/descriptor.go index 591b334380..1c436b2c83 100644 --- a/internal/encryption/keyprovider/openbao/descriptor.go +++ b/internal/encryption/keyprovider/openbao/descriptor.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package openbao import "github.com/opentofu/opentofu/internal/encryption/keyprovider" diff --git a/internal/encryption/keyprovider/openbao/provider.go b/internal/encryption/keyprovider/openbao/provider.go index 594a5fa6e1..2c551d0ee5 100644 --- a/internal/encryption/keyprovider/openbao/provider.go +++ b/internal/encryption/keyprovider/openbao/provider.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package openbao import ( diff --git a/internal/encryption/keyprovider/output.go b/internal/encryption/keyprovider/output.go index 057b51ef80..94b027c338 100644 --- a/internal/encryption/keyprovider/output.go +++ b/internal/encryption/keyprovider/output.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package keyprovider import "github.com/zclconf/go-cty/cty" diff --git a/internal/encryption/method/aesgcm/aesgcm_internal_test.go b/internal/encryption/method/aesgcm/aesgcm_internal_test.go index 2e60a5c201..686bd326ce 100644 --- a/internal/encryption/method/aesgcm/aesgcm_internal_test.go +++ b/internal/encryption/method/aesgcm/aesgcm_internal_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aesgcm import ( diff --git a/internal/encryption/method/aesgcm/aesgcm_test.go b/internal/encryption/method/aesgcm/aesgcm_test.go index 4c8cf01516..29a5512157 100644 --- a/internal/encryption/method/aesgcm/aesgcm_test.go +++ b/internal/encryption/method/aesgcm/aesgcm_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aesgcm_test import ( diff --git a/internal/encryption/method/aesgcm/config_test.go b/internal/encryption/method/aesgcm/config_test.go index b5827fe384..6aec087423 100644 --- a/internal/encryption/method/aesgcm/config_test.go +++ b/internal/encryption/method/aesgcm/config_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aesgcm import ( diff --git a/internal/encryption/method/aesgcm/descriptor_test.go b/internal/encryption/method/aesgcm/descriptor_test.go index c96fa79827..d4d4292fa4 100644 --- a/internal/encryption/method/aesgcm/descriptor_test.go +++ b/internal/encryption/method/aesgcm/descriptor_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aesgcm_test import ( diff --git a/internal/encryption/method/aesgcm/example_test.go b/internal/encryption/method/aesgcm/example_test.go index fecf0b1bfb..267e1a0942 100644 --- a/internal/encryption/method/aesgcm/example_test.go +++ b/internal/encryption/method/aesgcm/example_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aesgcm_test import ( diff --git a/internal/encryption/method/aesgcm/panic.go b/internal/encryption/method/aesgcm/panic.go index 5e6d79336c..03de0b7b9e 100644 --- a/internal/encryption/method/aesgcm/panic.go +++ b/internal/encryption/method/aesgcm/panic.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aesgcm import "fmt" diff --git a/internal/encryption/method/aesgcm/panic_test.go b/internal/encryption/method/aesgcm/panic_test.go index 5ad645cbf1..944b7b1a61 100644 --- a/internal/encryption/method/aesgcm/panic_test.go +++ b/internal/encryption/method/aesgcm/panic_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package aesgcm import ( diff --git a/internal/encryption/method/errors.go b/internal/encryption/method/errors.go index 565f1a437b..64a4c11c08 100644 --- a/internal/encryption/method/errors.go +++ b/internal/encryption/method/errors.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package method import "fmt" diff --git a/internal/encryption/method/unencrypted/method.go b/internal/encryption/method/unencrypted/method.go index 0a78d0e5fa..844a4f0de3 100644 --- a/internal/encryption/method/unencrypted/method.go +++ b/internal/encryption/method/unencrypted/method.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package unencrypted import ( diff --git a/internal/lang/blocktoattr/functions.go b/internal/lang/blocktoattr/functions.go index 8781c324e5..19a14acd8e 100644 --- a/internal/lang/blocktoattr/functions.go +++ b/internal/lang/blocktoattr/functions.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package blocktoattr import ( diff --git a/internal/plugin/convert/function.go b/internal/plugin/convert/function.go index 878de7447e..736c94d114 100644 --- a/internal/plugin/convert/function.go +++ b/internal/plugin/convert/function.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package convert import ( diff --git a/internal/plugin6/convert/function.go b/internal/plugin6/convert/function.go index 56d9f6edb6..451970a7ed 100644 --- a/internal/plugin6/convert/function.go +++ b/internal/plugin6/convert/function.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package convert import ( diff --git a/internal/tofu/context_functions.go b/internal/tofu/context_functions.go index b5b03ca7c9..7957cea8fa 100644 --- a/internal/tofu/context_functions.go +++ b/internal/tofu/context_functions.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package tofu import ( diff --git a/internal/tofu/context_functions_test.go b/internal/tofu/context_functions_test.go index fc1b735247..3a92340c42 100644 --- a/internal/tofu/context_functions_test.go +++ b/internal/tofu/context_functions_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package tofu import ( diff --git a/internal/tofu/transform_attach_config_resource_test.go b/internal/tofu/transform_attach_config_resource_test.go index d6eae363c7..a8e8181c26 100644 --- a/internal/tofu/transform_attach_config_resource_test.go +++ b/internal/tofu/transform_attach_config_resource_test.go @@ -1,3 +1,8 @@ +// Copyright (c) The OpenTofu Authors +// SPDX-License-Identifier: MPL-2.0 +// Copyright (c) 2023 HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package tofu import ( diff --git a/scripts/add-copyright-headers.sh b/scripts/add-copyright-headers.sh new file mode 100755 index 0000000000..34b332701b --- /dev/null +++ b/scripts/add-copyright-headers.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Copyright (c) The OpenTofu Authors +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2023 HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +go run github.com/hashicorp/copywrite headers diff --git a/tools.go b/tools.go index 91c8520bb6..bae84b9e7b 100644 --- a/tools.go +++ b/tools.go @@ -13,6 +13,7 @@ package tools // Go toolchain to see that we need to include them in go.mod and go.sum. import ( + _ "github.com/hashicorp/copywrite" _ "github.com/nishanths/exhaustive/cmd/exhaustive" _ "golang.org/x/tools/cmd/stringer" _ "honnef.co/go/tools/cmd/staticcheck" diff --git a/website/README.md b/website/README.md index 227bf53549..014e9ee37f 100644 --- a/website/README.md +++ b/website/README.md @@ -33,3 +33,7 @@ To update the sidebar navigation, you must edit the appropriate `nav-data.json` Currently, you can preview your changes through the [opentofu/opentofu.org](https://github.com/opentofu/opentofu.org/blob/main/README.md) repository. Follow the [Getting Started](https://github.com/opentofu/opentofu.org/blob/main/README.md#getting-started) guide. + +## Copyright headers for code examples + +In order to not include copyright headers for code examples used in docs, please, add the files under `examples` folder. This way, it will be ignored on automated copyright headers check. diff --git a/website/docs/intro/install/DO_NOT_ADD_LICENSE_HEADERS.txt b/website/docs/intro/install/DO_NOT_ADD_LICENSE_HEADERS.txt deleted file mode 100644 index 0880c64b49..0000000000 --- a/website/docs/intro/install/DO_NOT_ADD_LICENSE_HEADERS.txt +++ /dev/null @@ -1,2 +0,0 @@ -Please do not add license headers and end-of-file line breaks to the examples in this folder. -They are embedded in the website, and it makes for really hard reading to have license headers 5-6 times in a page. \ No newline at end of file diff --git a/website/docs/intro/install/alpine.mdx b/website/docs/intro/install/alpine.mdx index 1d4697f397..4e3cd8f02d 100644 --- a/website/docs/intro/install/alpine.mdx +++ b/website/docs/intro/install/alpine.mdx @@ -8,8 +8,8 @@ description: |- import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import ApkConvenienceScript from '!!raw-loader!./alpine-convenience.sh' -import ApkManualScript from '!!raw-loader!./alpine-manual.sh' +import ApkConvenienceScript from '!!raw-loader!./examples/alpine-convenience.sh' +import ApkManualScript from '!!raw-loader!./examples/alpine-manual.sh' # Installing OpenTofu on Alpine Linux diff --git a/website/docs/intro/install/alpine.sh b/website/docs/intro/install/alpine.sh index 1d050e52c7..5e83b274cc 100755 --- a/website/docs/intro/install/alpine.sh +++ b/website/docs/intro/install/alpine.sh @@ -1,13 +1,18 @@ #!/bin/sh +# Copyright (c) The OpenTofu Authors +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2023 HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + set -e apk add curl if [ "$1" = "--convenience" ]; then - sh -x alpine-convenience.sh + sh -x examples/alpine-convenience.sh else - sh -x alpine-manual.sh + sh -x examples/alpine-manual.sh fi tofu --version \ No newline at end of file diff --git a/website/docs/intro/install/brew.sh b/website/docs/intro/install/brew.sh index 291d8a4f71..473cdd5b91 100755 --- a/website/docs/intro/install/brew.sh +++ b/website/docs/intro/install/brew.sh @@ -1,4 +1,9 @@ #!/bin/bash +# Copyright (c) The OpenTofu Authors +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2023 HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + set -ex @@ -10,6 +15,6 @@ apt-get install -y curl git build-essential gcc procps curl file (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /root/.bashrc eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" -bash -x brew-install.sh +bash -x examples/brew-install.sh tofu --version diff --git a/website/docs/intro/install/bsd.mdx b/website/docs/intro/install/bsd.mdx index 9cad42aa27..cb4f82c763 100644 --- a/website/docs/intro/install/bsd.mdx +++ b/website/docs/intro/install/bsd.mdx @@ -8,8 +8,8 @@ description: |- import CodeBlock from '@theme/CodeBlock'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import ApkConvenienceScript from '!!raw-loader!./alpine-convenience.sh' -import ApkManualScript from '!!raw-loader!./alpine-manual.sh' +import ApkConvenienceScript from '!!raw-loader!./examples/alpine-convenience.sh' +import ApkManualScript from '!!raw-loader!./examples/alpine-manual.sh' # Installing OpenTofu on FreeBSD diff --git a/website/docs/intro/install/deb.mdx b/website/docs/intro/install/deb.mdx index 61530a973f..5057ef4bd3 100644 --- a/website/docs/intro/install/deb.mdx +++ b/website/docs/intro/install/deb.mdx @@ -6,11 +6,11 @@ description: |- --- import CodeBlock from '@theme/CodeBlock'; -import DebConvenienceScript from '!!raw-loader!./deb-convenience.sh' -import DebStep1Script from '!!raw-loader!./deb-step1.sh' -import DebStep2Script from '!!raw-loader!./deb-step2.sh' -import DebStep3Script from '!!raw-loader!./deb-step3.sh' -import DebStep4Script from '!!raw-loader!./deb-step4.sh' +import DebConvenienceScript from '!!raw-loader!./examples/deb-convenience.sh' +import DebStep1Script from '!!raw-loader!./examples/deb-step1.sh' +import DebStep2Script from '!!raw-loader!./examples/deb-step2.sh' +import DebStep3Script from '!!raw-loader!./examples/deb-step3.sh' +import DebStep4Script from '!!raw-loader!./examples/deb-step4.sh' import Buildkite from './buildkite' # Installing OpenTofu on .deb-based Linux (Debian, Ubuntu, etc.) diff --git a/website/docs/intro/install/deb.sh b/website/docs/intro/install/deb.sh index cd60764956..c300b2afe7 100755 --- a/website/docs/intro/install/deb.sh +++ b/website/docs/intro/install/deb.sh @@ -1,4 +1,9 @@ #!/bin/bash +# Copyright (c) The OpenTofu Authors +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2023 HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + set -e @@ -6,12 +11,12 @@ apt update apt install -y sudo curl if [ "$1" = "--convenience" ]; then - bash -ex deb-convenience.sh + bash -ex examples/deb-convenience.sh else - bash -ex deb-step1.sh - bash -ex deb-step2.sh - bash -ex deb-step3.sh - bash -ex deb-step4.sh + bash -ex examples/deb-step1.sh + bash -ex examples/deb-step2.sh + bash -ex examples/deb-step3.sh + bash -ex examples/deb-step4.sh fi tofu --version \ No newline at end of file diff --git a/website/docs/intro/install/docker.mdx b/website/docs/intro/install/docker.mdx index 4b4721ed72..2ae2491f95 100644 --- a/website/docs/intro/install/docker.mdx +++ b/website/docs/intro/install/docker.mdx @@ -6,8 +6,8 @@ description: |- --- import CodeBlock from '@theme/CodeBlock'; -import DockerPullScript from '!!raw-loader!./docker-pull.sh' -import DockerRunScript from '!!raw-loader!./docker-run.sh' +import DockerPullScript from '!!raw-loader!./examples/docker-pull.sh' +import DockerRunScript from '!!raw-loader!./examples/docker-run.sh' # Use OpenTofu as Docker Image diff --git a/website/docs/intro/install/alpine-convenience.sh b/website/docs/intro/install/examples/alpine-convenience.sh similarity index 100% rename from website/docs/intro/install/alpine-convenience.sh rename to website/docs/intro/install/examples/alpine-convenience.sh diff --git a/website/docs/intro/install/alpine-manual.sh b/website/docs/intro/install/examples/alpine-manual.sh similarity index 100% rename from website/docs/intro/install/alpine-manual.sh rename to website/docs/intro/install/examples/alpine-manual.sh diff --git a/website/docs/intro/install/brew-install.sh b/website/docs/intro/install/examples/brew-install.sh similarity index 100% rename from website/docs/intro/install/brew-install.sh rename to website/docs/intro/install/examples/brew-install.sh diff --git a/website/docs/intro/install/deb-convenience.sh b/website/docs/intro/install/examples/deb-convenience.sh similarity index 100% rename from website/docs/intro/install/deb-convenience.sh rename to website/docs/intro/install/examples/deb-convenience.sh diff --git a/website/docs/intro/install/deb-step1.sh b/website/docs/intro/install/examples/deb-step1.sh similarity index 100% rename from website/docs/intro/install/deb-step1.sh rename to website/docs/intro/install/examples/deb-step1.sh diff --git a/website/docs/intro/install/deb-step2.sh b/website/docs/intro/install/examples/deb-step2.sh similarity index 100% rename from website/docs/intro/install/deb-step2.sh rename to website/docs/intro/install/examples/deb-step2.sh diff --git a/website/docs/intro/install/deb-step3.sh b/website/docs/intro/install/examples/deb-step3.sh similarity index 100% rename from website/docs/intro/install/deb-step3.sh rename to website/docs/intro/install/examples/deb-step3.sh diff --git a/website/docs/intro/install/deb-step4.sh b/website/docs/intro/install/examples/deb-step4.sh similarity index 100% rename from website/docs/intro/install/deb-step4.sh rename to website/docs/intro/install/examples/deb-step4.sh diff --git a/website/docs/intro/install/docker-pull.sh b/website/docs/intro/install/examples/docker-pull.sh similarity index 100% rename from website/docs/intro/install/docker-pull.sh rename to website/docs/intro/install/examples/docker-pull.sh diff --git a/website/docs/intro/install/docker-run.sh b/website/docs/intro/install/examples/docker-run.sh similarity index 100% rename from website/docs/intro/install/docker-run.sh rename to website/docs/intro/install/examples/docker-run.sh diff --git a/website/docs/intro/install/install-yum.sh b/website/docs/intro/install/examples/install-yum.sh similarity index 100% rename from website/docs/intro/install/install-yum.sh rename to website/docs/intro/install/examples/install-yum.sh diff --git a/website/docs/intro/install/install-zypper.sh b/website/docs/intro/install/examples/install-zypper.sh similarity index 100% rename from website/docs/intro/install/install-zypper.sh rename to website/docs/intro/install/examples/install-zypper.sh diff --git a/website/docs/intro/install/repo-yum.sh b/website/docs/intro/install/examples/repo-yum.sh similarity index 100% rename from website/docs/intro/install/repo-yum.sh rename to website/docs/intro/install/examples/repo-yum.sh diff --git a/website/docs/intro/install/repo-zypper.sh b/website/docs/intro/install/examples/repo-zypper.sh similarity index 100% rename from website/docs/intro/install/repo-zypper.sh rename to website/docs/intro/install/examples/repo-zypper.sh diff --git a/website/docs/intro/install/rpm-convenience.sh b/website/docs/intro/install/examples/rpm-convenience.sh similarity index 100% rename from website/docs/intro/install/rpm-convenience.sh rename to website/docs/intro/install/examples/rpm-convenience.sh diff --git a/website/docs/intro/install/standalone-install.ps1 b/website/docs/intro/install/examples/standalone-install.ps1 similarity index 100% rename from website/docs/intro/install/standalone-install.ps1 rename to website/docs/intro/install/examples/standalone-install.ps1 diff --git a/website/docs/intro/install/standalone-install.sh b/website/docs/intro/install/examples/standalone-install.sh similarity index 100% rename from website/docs/intro/install/standalone-install.sh rename to website/docs/intro/install/examples/standalone-install.sh diff --git a/website/docs/intro/install/verify-checksum-linux.sh b/website/docs/intro/install/examples/verify-checksum-linux.sh similarity index 100% rename from website/docs/intro/install/verify-checksum-linux.sh rename to website/docs/intro/install/examples/verify-checksum-linux.sh diff --git a/website/docs/intro/install/verify-checksum-macos.sh b/website/docs/intro/install/examples/verify-checksum-macos.sh similarity index 100% rename from website/docs/intro/install/verify-checksum-macos.sh rename to website/docs/intro/install/examples/verify-checksum-macos.sh diff --git a/website/docs/intro/install/verify-checksum.ps1 b/website/docs/intro/install/examples/verify-checksum.ps1 similarity index 100% rename from website/docs/intro/install/verify-checksum.ps1 rename to website/docs/intro/install/examples/verify-checksum.ps1 diff --git a/website/docs/intro/install/verify-cosign.ps1 b/website/docs/intro/install/examples/verify-cosign.ps1 similarity index 100% rename from website/docs/intro/install/verify-cosign.ps1 rename to website/docs/intro/install/examples/verify-cosign.ps1 diff --git a/website/docs/intro/install/verify-cosign.sh b/website/docs/intro/install/examples/verify-cosign.sh similarity index 100% rename from website/docs/intro/install/verify-cosign.sh rename to website/docs/intro/install/examples/verify-cosign.sh diff --git a/website/docs/intro/install/homebrew.mdx b/website/docs/intro/install/homebrew.mdx index 1e492e3bb1..05afb9719d 100644 --- a/website/docs/intro/install/homebrew.mdx +++ b/website/docs/intro/install/homebrew.mdx @@ -6,7 +6,7 @@ description: |- --- import CodeBlock from '@theme/CodeBlock'; -import BrewScript from '!!raw-loader!./brew-install.sh' +import BrewScript from '!!raw-loader!./examples/brew-install.sh' # Installing OpenTofu via Homebrew diff --git a/website/docs/intro/install/rpm.mdx b/website/docs/intro/install/rpm.mdx index 8fb8bc5ce5..82c67253aa 100644 --- a/website/docs/intro/install/rpm.mdx +++ b/website/docs/intro/install/rpm.mdx @@ -8,11 +8,11 @@ description: |- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import RpmConvenienceScript from '!!raw-loader!./rpm-convenience.sh' -import YumRepoScript from '!!raw-loader!./repo-yum.sh' -import ZypperRepoScript from '!!raw-loader!./repo-zypper.sh' -import YumInstallScript from '!!raw-loader!./install-yum.sh' -import ZypperInstallScript from '!!raw-loader!./install-zypper.sh' +import RpmConvenienceScript from '!!raw-loader!./examples/rpm-convenience.sh' +import YumRepoScript from '!!raw-loader!./examples/repo-yum.sh' +import ZypperRepoScript from '!!raw-loader!./examples/repo-zypper.sh' +import YumInstallScript from '!!raw-loader!./examples/install-yum.sh' +import ZypperInstallScript from '!!raw-loader!./examples/install-zypper.sh' import Buildkite from "./buildkite"; # Installing OpenTofu on RHEL, openSUSE, AlmaLinux and other RPM-based distributions diff --git a/website/docs/intro/install/rpm.sh b/website/docs/intro/install/rpm.sh index cfbb94f73d..bc1c4a9ad8 100755 --- a/website/docs/intro/install/rpm.sh +++ b/website/docs/intro/install/rpm.sh @@ -1,22 +1,27 @@ #!/bin/bash +# Copyright (c) The OpenTofu Authors +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2023 HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + set -e if [ -f /usr/bin/zypper ]; then zypper install -y sudo if [ "$1" = "--convenience" ]; then - bash -ex rpm-convenience.sh + bash -ex examples/rpm-convenience.sh else - bash -ex repo-zypper.sh - bash -ex install-zypper.sh + bash -ex examples/repo-zypper.sh + bash -ex examples/install-zypper.sh fi else yum install -y sudo if [ "$1" = "--convenience" ]; then - bash -ex rpm-convenience.sh + bash -ex examples/rpm-convenience.sh else - bash -ex repo-yum.sh - bash -ex install-yum.sh + bash -ex examples/repo-yum.sh + bash -ex examples/install-yum.sh fi fi diff --git a/website/docs/intro/install/standalone.mdx b/website/docs/intro/install/standalone.mdx index 03f0d4db6b..f81a019bf3 100644 --- a/website/docs/intro/install/standalone.mdx +++ b/website/docs/intro/install/standalone.mdx @@ -8,13 +8,13 @@ description: |- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import LinuxScript from '!!raw-loader!./standalone-install.sh' -import WindowsScript from '!!raw-loader!./standalone-install.ps1' -import VerifyChecksumPS1 from '!!raw-loader!./verify-checksum.ps1' -import VerifyChecksumLinux from '!!raw-loader!./verify-checksum-linux.sh' -import VerifyChecksumMacOS from '!!raw-loader!./verify-checksum-macos.sh' -import VerifyCosignLinux from '!!raw-loader!./verify-cosign.sh' -import VerifyCosignWindows from '!!raw-loader!./verify-cosign.ps1' +import LinuxScript from '!!raw-loader!./examples/standalone-install.sh' +import WindowsScript from '!!raw-loader!./examples/standalone-install.ps1' +import VerifyChecksumPS1 from '!!raw-loader!./examples/verify-checksum.ps1' +import VerifyChecksumLinux from '!!raw-loader!./examples/verify-checksum-linux.sh' +import VerifyChecksumMacOS from '!!raw-loader!./examples/verify-checksum-macos.sh' +import VerifyCosignLinux from '!!raw-loader!./examples/verify-cosign.sh' +import VerifyCosignWindows from '!!raw-loader!./examples/verify-cosign.ps1' import Admonition from '@theme/Admonition'; # Installing OpenTofu from GitHub Releases diff --git a/website/docs/intro/install/test-install-instructions.sh b/website/docs/intro/install/test-install-instructions.sh index 97374c2db8..390a2a731a 100755 --- a/website/docs/intro/install/test-install-instructions.sh +++ b/website/docs/intro/install/test-install-instructions.sh @@ -1,4 +1,9 @@ #!/bin/bash +# Copyright (c) The OpenTofu Authors +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2023 HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + # This script tests the installation instructions on all relevant Linux operating systems listed in docker-compose.yaml.