### Install copystructure Go Library Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/mitchellh/copystructure/README.md Use standard go get to install the library. No specific setup is required beyond this. ```bash $ go get github.com/mitchellh/copystructure ``` -------------------------------- ### Install fatih/color Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/fatih/color/README.md Use 'go get' to install the color library. ```bash go get github.com/fatih/color ``` -------------------------------- ### Install go-version Library Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/go-version/README.md Use 'go get' to install the go-version library for use in your Go projects. ```bash $ go get github.com/hashicorp/go-version ``` -------------------------------- ### Install go-isatty Package Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/mattn/go-isatty/README.md Install the go-isatty package using the go get command. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Install msgpack/v5 Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/vmihailenco/msgpack/v5/README.md Install the msgpack/v5 library using go get. Ensure you have initialized a Go module first. ```shell go mod init github.com/my/repo ``` ```shell go get github.com/vmihailenco/msgpack/v5 ``` -------------------------------- ### Install Golang Tag Parser Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/vmihailenco/tagparser/v2/README.md Use 'go get' to install the v2 of the tagparser library. ```shell go get github.com/vmihailenco/tagparser/v2 ``` -------------------------------- ### Install Levenshtein Package Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/agext/levenshtein/README.md Use 'go get' to install the Levenshtein package for your Go project. ```go go get github.com/agext/levenshtein ``` -------------------------------- ### Quickstart: Marshal and Unmarshal Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/vmihailenco/msgpack/README.md Demonstrates basic usage of msgpack for encoding and decoding a Go struct. Ensure the struct fields are exported for proper serialization. ```go func ExampleMarshal() { type Item struct { Foo string } b, err := msgpack.Marshal(&Item{Foo: "bar"}) if err != nil { panic(err) } var item Item err = msgpack.Unmarshal(b, &item) if err != nil { panic(err) } fmt.Println(item.Foo) // Output: bar } ``` -------------------------------- ### Install mapstructure Go Library Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/mitchellh/mapstructure/README.md Use standard go get to install the mapstructure library. This is the initial step before using its decoding functionalities. ```bash go get github.com/mitchellh/mapstructure ``` -------------------------------- ### hc-install Installation Output Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/hc-install/README.md This is an example of the output you can expect after successfully installing a HashiCorp product using hc-install. ```text hc-install: will install terraform@1.3.7 installed terraform@1.3.7 to /current/working/dir/terraform ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/mattn/go-colorable/README.md Install the go-colorable package using the go get command. This is a prerequisite for using the package in your Go projects. ```bash $ go get github.com/mattn/go-colorable ``` -------------------------------- ### Clone and Apply Terraform Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/examples/README.md Demonstrates the basic workflow for running a Terraform example from the repository. This involves cloning the repository, changing into the example directory, and applying the configuration. ```bash $ git clone https://github.com/C2Devel/terraform-provider-rockitcloud $ cd terraform-provider-rockitcloud/examples/count $ terraform apply ... ``` -------------------------------- ### Terraform Initialization Success Output Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/dev-docs/contributing/maintaining.md Example output indicating successful Terraform initialization after backend setup. ```console $ terraform init ... Terraform has been successfully initialized! ``` -------------------------------- ### Passing Code: Get() and GetOk() Usage Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR001/README.md These examples show the recommended alternatives, Get() and GetOk(), which should be used instead of GetOkExists(). They provide more reliable data retrieval. ```go d.Get("example") ``` ```go d.GetOk("example") ``` -------------------------------- ### Install Development Tools Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/dev-docs/contributing/development-environment.md Install the necessary tools required for developing the provider. This command should be run from within the provider's directory. ```sh make tools ``` -------------------------------- ### Install a HashiCorp Product Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/hc-install/README.md Use this command to install a specific version of a HashiCorp product. The product will be installed in the current working directory by default. ```sh hc-install install -version 1.3.7 terraform ``` -------------------------------- ### Installer API Methods Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/hc-install/README.md The Installer interface provides high-level methods for managing HashiCorp product versions. ```APIDOC ## Installer Methods ### `Ensure(context.Context, []src.Source)` **Description**: Finds, installs, or builds a specific product version. ### `Install(context.Context, []src.Installable)` **Description**: Installs a specific product version. ``` -------------------------------- ### Example Usage with ACL Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/s3_bucket_acl.md This example demonstrates how to configure an S3 bucket ACL using a predefined canned ACL. ```APIDOC ## Resource: aws_s3_bucket_acl Manages an S3 bucket ACL. ### Argument Reference The following arguments are supported: * `acl` - (Optional, Conflicts with `access_control_policy`) The canned ACL to apply to the bucket. * _Valid values:_ `private`, `public-read`, `public-read-write`, `authenticated-read` * `bucket` - (Required, Forces new resource) The name of the bucket. ### Request Example ```terraform resource "aws_s3_bucket" "example" { bucket = "tf-example" } resource "aws_s3_bucket_acl" "example_bucket_acl" { bucket = aws_s3_bucket.example.id acl = "private" } ``` ``` -------------------------------- ### Example Usage of aws_paas_backup_users Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/paas_backup_users.md Demonstrates how to fetch active PaaS backup users and output their login names. Requires no specific setup beyond Terraform configuration. ```terraform data "aws_paas_backup_users" "selected" { active_only = true } output "backup-user-logins" { value = data.aws_paas_backup_users.selected.users[*].login } ``` -------------------------------- ### CLI Installation - Homebrew Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/hc-install/README.md Instructions for installing the hc-install CLI using Homebrew on macOS and Linux. ```APIDOC ## CLI Installation ### Homebrew (macOS / Linux) ```bash brew install hashicorp/tap/hc-install ``` ``` -------------------------------- ### Install Go Tools Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/dev-docs/contributing/pullrequest-submission-and-lifecycle.md Installs linters and other development tools using the project's Makefile. Run this in the terraform-provider-aws directory. ```console % cd terraform-provider-aws % make tools ``` -------------------------------- ### Global Policy Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/iam_policy.md This example demonstrates how to create a global IAM policy with specific access rules. ```APIDOC ## Resource: aws_iam_policy ### Description Manages an IAM policy. ### Example Usage #### Global Policy ```terraform resource "aws_iam_policy" "example" { name = "tf-policy-global" description = "tf-policy-global description" type = "global" policy = jsonencode( { Statement = [ { Action = ["iam:ListUsers"], }, ] } ) } ``` ### Argument Reference * `description` - (Optional, Editable) The description of the policy. The value must be no longer than 1000 characters. * `name` - (Optional, Conflicts with `name_prefix`) The name of the policy. The value can only contain Latin letters, numbers, underscores (_), plus (+) and equal (=) signs, commas (,), periods (.), at symbols (@) and hyphens (-) (`^["w+=,.@-]*$`). The value must be 1 to 128 characters long. * `name_prefix` - (Optional, Conflicts with `name`) Creates a unique name starting with the specified prefix. The value has the same character restrictions as `name`. The value must be 1 to 102 characters long. * `policy` - (Required, Editable) A string with policy-defined access rules in JSON format. * `type` - (Required) The type of the policy. * _Valid values:_ `global`, `project` ### Attribute Reference * `arn` - The Amazon Resource Name (ARN) of the policy. * `create_date` - The time in [RFC3339 format] when the policy was created. * `id` - The ARN of the policy. * `owner` - The owner of the policy. * `policy_id` - The ID of the policy. * `update_date` - The time in [RFC3339 format] when the policy was last updated. ### Import IAM policy can be imported using `arn`, e.g., import a policy `policy-example` provided by a customer `test.customer`: ``` $ terraform import aws_iam_policy.example arn:c2:iam::test.customer:policy/policy-example ``` ``` -------------------------------- ### Project Policy Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/iam_policy.md This example shows how to create a project-specific IAM policy with multiple access rules. ```APIDOC ## Resource: aws_iam_policy ### Description Manages an IAM policy. ### Example Usage #### Project Policy ```terraform resource "aws_iam_policy" "example" { name = "tf-policy-project" description = "tf-policy-project description" type = "project" policy = jsonencode( { Statement = [ { Action = [ "cloudwatch:DescribeAlarms", ] }, { Action = [ "ec2:DescribeVpcs", "ec2:DescribeVpcAttribute", ] }, ] } ) } ``` ### Argument Reference * `description` - (Optional, Editable) The description of the policy. The value must be no longer than 1000 characters. * `name` - (Optional, Conflicts with `name_prefix`) The name of the policy. The value can only contain Latin letters, numbers, underscores (_), plus (+) and equal (=) signs, commas (,), periods (.), at symbols (@) and hyphens (-) (`^["w+=,.@-]*$`). The value must be 1 to 128 characters long. * `name_prefix` - (Optional, Conflicts with `name`) Creates a unique name starting with the specified prefix. The value has the same character restrictions as `name`. The value must be 1 to 102 characters long. * `policy` - (Required, Editable) A string with policy-defined access rules in JSON format. * `type` - (Required) The type of the policy. * _Valid values:_ `global`, `project` ### Attribute Reference * `arn` - The Amazon Resource Name (ARN) of the policy. * `create_date` - The time in [RFC3339 format] when the policy was created. * `id` - The ARN of the policy. * `owner` - The owner of the policy. * `policy_id` - The ID of the policy. * `update_date` - The time in [RFC3339 format] when the policy was last updated. ### Import IAM policy can be imported using `arn`, e.g., import a policy `policy-example` provided by a customer `test.customer`: ``` $ terraform import aws_iam_policy.example arn:c2:iam::test.customer:policy/policy-example ``` ``` -------------------------------- ### New Guide Changelog Entry Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/dev-docs/contributing/changelog-process.md For new full-length documentation guides, use the `release-note:new-guide` header followed by the title of the documentation added. ```markdown ```release-note:new-guide Custom Service Endpoint Configuration ``` ``` -------------------------------- ### EBS Snapshot Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/ebs_snapshot.md This example demonstrates how to create an EBS volume and then create a snapshot of that volume. Ensure the availability zone for the volume is correctly specified. ```terraform resource "aws_ebs_volume" "example" { availability_zone = "ru-msk-vol52" size = 40 tags = { Name = "HelloWorld" } } resource "aws_ebs_snapshot" "example_snapshot" { volume_id = aws_ebs_volume.example.id tags = { Name = "HelloWorld_snap" } } ``` -------------------------------- ### Example Usage Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/availability_zone.md This example shows how to use the `aws_availability_zone` data source to retrieve information about a specific availability zone and output its ID. ```terraform data "aws_availability_zone" "example" { name = "ru-msk-vol52" } output "availability_zone_to_region" { value = data.aws_availability_zone.example.id } ``` -------------------------------- ### CLI Installation - Linux (Debian/Ubuntu/RPM) Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/hc-install/README.md Instructions for installing the hc-install CLI on Debian/Ubuntu via apt and RHEL/CentOS/Fedora/Amazon Linux via RPM, using official HashiCorp repositories. ```APIDOC ### Linux Follow the instructions in the [Official Packaging Guide](https://www.hashicorp.com/official-packaging-guide) to install the `hc-install` package from the official HashiCorp-maintained repositories. ``` -------------------------------- ### Example Usage with Grants Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/s3_bucket_acl.md This example shows how to configure an S3 bucket ACL with custom grants, specifying permissions for different grantees. ```APIDOC ## Resource: aws_s3_bucket_acl Manages an S3 bucket ACL. ### Argument Reference The following arguments are supported: * `access_control_policy` - (Optional, Conflicts with `acl`) A configuration block that sets the ACL permissions for an object per grantee. * `bucket` - (Required, Forces new resource) The name of the bucket. ### access_control_policy The `access_control_policy` configuration block supports the following arguments: * `grant` - (Required) Set of `grant` configuration blocks. * `owner` - (Required) Configuration block of the bucket owner's display name and ID. ### grant The `grant` configuration block supports the following arguments: * `grantee` - (Required) Configuration block for the person being granted permissions. * `permission` - (Required) Logging permissions assigned to the grantee for the bucket. * _Valid values:_ `READ`, `WRITE`, `READ_ACP`, `WRITE_ACP`, `FULL_CONTROL` ### grantee The `grantee` configuration block supports the following arguments: * `id` - (Optional) The canonical user ID of the grantee. * `type` - (Required) Type of grantee. * _Valid values:_ `CanonicalUser`, `AmazonCustomerByEmail`, `Group` * `uri` - (Optional) URI of the grantee group. ### owner The `owner` configuration block supports the following arguments: * `id` - (Required) The ID of the owner. * `display_name` - (Optional) The display name of the owner. ### Request Example ```terraform data "aws_canonical_user_id" "current" {} resource "aws_s3_bucket" "example" { bucket = "tf-example" } resource "aws_s3_bucket_acl" "example" { bucket = aws_s3_bucket.example.id access_control_policy { grant { grantee { id = data.aws_canonical_user_id.current.id type = "CanonicalUser" } permission = "READ" } grant { grantee { type = "Group" uri = "http://acs.amazonaws.com/groups/global/AllUsers" } permission = "READ_ACP" } owner { id = data.aws_canonical_user_id.current.id } } } ``` ``` -------------------------------- ### Install hc-install via apt (Debian/Ubuntu) Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/hc-install/README.md Installs the hc-install package on Debian-based Linux distributions using apt. Ensure you follow the Official Packaging Guide for repository setup. ```bash sudo apt-get update && sudo apt-get install hc-install ``` -------------------------------- ### Yamux Server Setup and Stream Handling Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/yamux/README.md Illustrates how to set up a Yamux server session to accept incoming TCP connections and handle streams. Includes reading data from an accepted stream. ```go func server() { // Accept a TCP connection conn, err := listener.Accept() if err != nil { panic(err) } // Setup server side of yamux session, err := yamux.Server(conn, nil) if err != nil { panic(err) } // Accept a stream stream, err := session.Accept() if err != nil { panic(err) } // Listen for a message buf := make([]byte, 4) stream.Read(buf) } ``` -------------------------------- ### Example Usage: Retrieving all subnet IDs and their CIDR blocks Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/subnet_ids.md This example demonstrates how to fetch all subnet IDs within a VPC and then retrieve the CIDR block for each subnet. It utilizes `aws_subnets` to get the IDs and `aws_subnet` to get individual subnet details. ```terraform variable vpc_id {} data "aws_subnets" "example" { filter { name = "vpc-id" values = [var.vpc_id] } } data "aws_subnet" "example" { for_each = toset(data.aws_subnets.example.ids) id = each.value } output "subnet_cidr_blocks" { value = [for s in data.aws_subnet.example : s.cidr_block] } ``` -------------------------------- ### EFS File System with tags Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/efs_file_system.md This example demonstrates how to create an EFS file system with a unique creation token and assign tags to it. ```APIDOC ## Resource: aws_efs_file_system Creates an Elastic File System (EFS) file system. ### Example usage #### EFS File System with tags ```terraform resource "aws_efs_file_system" "example" { creation_token = "my-product" tags = { Name = "MyProduct" } } ``` ## Argument reference The following arguments are supported: * `creation_token` - (Optional) A unique name used as reference when creating the Elastic File System to ensure idempotent file system creation. By default generated by Terraform. See [Elastic File System][efs] user guide for more information. * _Value length:_ From 1 to 64 symbols * `tags` - (Optional) A map of tags to assign to the file system. If a provider [`default_tags` configuration block][default-tags] is used, tags with matching keys will overwrite those defined at the provider level. ## Attributes reference In addition to all arguments above, the following attributes are exported: * `id` - The ID that identifies the file system. * _Example:_ `fs-ccfc0d65` * `number_of_mount_targets` - The current number of mount targets that the file system has. * `owner_id` - The account that was used to create the file system. If the file system was created by an IAM user, the parent account to which the user belongs is the owner. * `performance_mode` - The file system performance mode. * _Valid values:_ `"generalPurpose"` * `size_in_bytes` - The latest known metered size (in bytes) of data stored in the file system. The value is not the exact size that the file system was at any point in time. The structure of this block is [described below](#size_in_bytes). * `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block][default-tags]. ### size_in_bytes * `value` - The latest known metered size (in bytes) of data stored in the file system. ## Import The EFS file systems can be imported using the `id`, for example: ``` $ terraform import aws_efs_file_system.foo fs-6fa144c6 ``` ``` -------------------------------- ### Yamux Client Setup and Stream Usage Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/yamux/README.md Demonstrates how to set up a Yamux client session over a TCP connection and open a new stream for communication. The stream implements net.Conn. ```go func client() { // Get a TCP connection conn, err := net.Dial(...) if err != nil { panic(err) } // Setup client side of yamux session, err := yamux.Client(conn, nil) if err != nil { panic(err) } // Open a new stream stream, err := session.Open() if err != nil { panic(err) } // Stream implements net.Conn stream.Write([]byte("ping")) } ``` -------------------------------- ### Install hc-install via RPM (RHEL/CentOS/Fedora) Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/hc-install/README.md Installs the hc-install package on RPM-based Linux distributions. Refer to the Official Packaging Guide for repository configuration. ```bash sudo yum install hc-install # or sudo dnf install hc-install ``` -------------------------------- ### aws_availability_zone Data Source Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/availability_zone.md Example of how to use the aws_availability_zone data source to get information about a specific availability zone and output its ID (which corresponds to the region). ```APIDOC ## Data Source: aws_availability_zone Provides information about an availability zone. To get a list of the available zones, use the [`aws_availability_zones`](availability_zones.md) (plural) data source. ### Example Usage ```terraform data "aws_availability_zone" "example" { name = "ru-msk-vol52" } output "availability_zone_to_region" { value = data.aws_availability_zone.example.id } ``` ## Argument Reference The arguments of this data source act as filters for querying the available availability zones. The given filters must match exactly one availability zone whose data will be exported as attributes. * `filter` - (Optional) One or more name/value pairs to use as filters. * _Valid values:_ See supported names and values in [EC2 API documentation][describe-azs] * `name` - (Optional) The full name of the availability zone to select. * `state` - (Optional) A specific availability zone state to require. * _Valid values:_ `available`, `information`, `impaired` ## Attribute Reference ### Supported attributes In addition to all arguments above, the following attributes are exported: * `region` - The region where the selected availability zone resides. ### Unsupported attributes ~> **Note** These attributes may be present in the `terraform.tfstate` file, but they have preset values and cannot be specified in configuration files. The following attributes are not currently supported: `all_availability_zones`, `group_name`, `network_border_group`, `opt_in_status`, `parent_zone_id`, `parent_zone_name`, `zone_id`, `zone_type`. ``` -------------------------------- ### Get App Engine Go SDK Package Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/google.golang.org/appengine/CONTRIBUTING.md Use 'go get -d' to download the App Engine Go SDK source code without installing it. ```bash go get -d google.golang.org/appengine ``` -------------------------------- ### Build sys/unix with Old Build System Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/golang.org/x/sys/unix/README.md Use `mkall.sh` to build files for your current OS and architecture with the old build system. Ensure GOOS and GOARCH are set correctly. Running `mkall.sh -n` shows the commands that will be run. ```bash mkall.sh ``` ```bash mkall.sh -n ``` -------------------------------- ### ExampleCompany::ExampleService::ExampleResource Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/internal/service/cloudformation/testdata/examplecompany-exampleservice-exampleresource/docs/README.md This resource represents an example resource with various properties and validation rules. ```APIDOC ## ExampleCompany::ExampleService::ExampleResource ### Description An example resource schema demonstrating some basic constructs and validation rules. ### Properties #### Title The title of the TPS report is a mandatory element. _Required_: Yes _Type_: String _Minimum_: 20 _Maximum_: 250 #### CoverSheetIncluded Required for all TPS Reports submitted after 2/19/1999 _Required_: No _Type_: Boolean #### DueDate _Required_: No _Type_: String #### ApprovalDate _Required_: No _Type_: String #### Memo _Required_: No _Type_: Memo #### SecondCopyOfMemo _Required_: No _Type_: Memo #### TestCode _Required_: Yes _Type_: String _Allowed Values_: NOT_STARTED | CANCELLED #### Authors _Required_: No _Type_: List of String #### Tags An array of key-value pairs to apply to this resource. _Required_: No _Type_: List of Tag ### Return Values #### Ref When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the TPSCode. #### Fn::GetAtt The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values. For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html). ##### TPSCode A TPS Code is automatically generated on creation and assigned as the unique identifier. ``` -------------------------------- ### Forward Action Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/lb_listener_rule.md This example demonstrates how to configure a listener rule to forward traffic to one or more target groups based on host header conditions. It includes the necessary setup for VPC, subnets, load balancer, target groups, and listener. ```terraform resource "aws_vpc" "example" { cidr_block = "10.1.0.0/16" tags = { Name = "tf-vpc" } } resource "aws_subnet" "example" { vpc_id = aws_vpc.example.id cidr_block = "10.1.1.0/24" tags = { Name = "tf-subnet" } } resource "aws_lb" "example" { name = "tf-lb" internal = true load_balancer_type = "application" subnets = [aws_subnet.example.id] tags = { Name = "tf-lb" } } resource "aws_lb_target_group" "default_tg" { name = "tf-lb-default-tg" target_type = "instance" port = 80 protocol = "HTTP" vpc_id = aws_vpc.example.id tags = { Name = "tf-lb-default-tg" } } resource "aws_lb_target_group" "another_tg" { name = "tf-lb-another-tg" target_type = "instance" port = 81 protocol = "HTTP" vpc_id = aws_vpc.example.id tags = { Name = "tf-lb-another-tg" } } resource "aws_lb_listener" "example" { load_balancer_arn = aws_lb.example.arn port = 1222 protocol = "HTTP" default_action { type = "forward" forward { target_group { arn = aws_lb_target_group.default_tg.arn } } } tags = { Name = "tf-lb-listener" } } resource "aws_lb_listener_rule" "forward_action" { listener_arn = aws_lb_listener.example.arn priority = 100 action { type = "forward" forward { target_group { arn = aws_lb_target_group.default_tg.arn weight = 80 } target_group { arn = aws_lb_target_group.another_tg.arn weight = 20 } } } condition { host_header { values = ["example.com"] } } } ``` -------------------------------- ### Example Usage of aws_s3_bucket_cors_configuration Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/s3_bucket_cors_configuration.md This example demonstrates how to configure CORS rules for an S3 bucket using Terraform. It includes two `cors_rule` blocks, one allowing PUT and POST methods with specific origins and headers, and another allowing GET methods from any origin. ```terraform resource "aws_s3_bucket" "example" { bucket = "tf-example" } resource "aws_s3_bucket_cors_configuration" "example" { bucket = aws_s3_bucket.example.bucket cors_rule { allowed_headers = ["*"] allowed_methods = ["PUT", "POST"] allowed_origins = ["https://s3-website-test.hashicorp.com"] expose_headers = ["ETag"] max_age_seconds = 3000 } cors_rule { allowed_methods = ["GET"] allowed_origins = ["*"] } } ``` -------------------------------- ### Initialize Terraform Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/examples/networking/README.md Run this command to download the necessary Terraform providers and modules for the project. ```bash terraform init ``` -------------------------------- ### Passing Resource Configurations Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/README.md These examples demonstrate configurations that pass the XR006 check. The first shows `Timeouts` aligned with existing implementations, and the second shows a resource without any `Timeouts` field. ```go // Fixed Timeouts field alignment &schema.Resource{ /* ... no Create ... */ Read: /* ... */, Timeouts: schema.ResourceTimesout{ Read: schema.DefaultTimeout(10 * time.Minute), }, } ``` ```go // Removed Timeouts &schema.Resource{ /* ... no Create ... */ Read: /* ... */, } ``` -------------------------------- ### Example Usage: Map Availability Zone to EBS Volume ID Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/ebs_volumes.md This example demonstrates how to obtain a map of availability zones to EBS volume IDs for volumes matching a specific tag. It first uses `aws_ebs_volumes` to get a list of IDs and then `aws_ebs_volume` to retrieve details for each volume. ```terraform data "aws_ebs_volumes" "example" { tags = { Name = "Example" } } data "aws_ebs_volume" "example" { for_each = toset(data.aws_ebs_volumes.example.ids) filter { name = "volume-id" values = [each.value] } } output "availability_zone_to_volume_id" { value = { for s in data.aws_ebs_volume.example : s.id => s.availability_zone } } ``` -------------------------------- ### Run Providerlint Help Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/README.md To get more information about a specific check, use the `help` command followed by the check name. ```console providerlint help NAME ``` -------------------------------- ### Transit Gateway Route Table Association Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/ec2_transit_gateway_route_table_association.md This example demonstrates how to create a Transit Gateway, a VPC, a subnet, a VPC attachment, a route table, and finally associate the VPC attachment with the route table. It requires prior setup of AWS resources like VPC and subnet. ```terraform resource "aws_vpc" "example" { cidr_block = "172.16.0.0/16" tags = { Name = "tf-vpc" } } resource "aws_subnet" "example" { vpc_id = aws_vpc.example.id cidr_block = cidrsubnet(aws_vpc.example.cidr_block, 4, 1) availability_zone = "ru-msk-vol52" tags = { Name = "tf-subnet" } } resource "aws_ec2_transit_gateway" "example" { description = "tf example" tags = { Name = "tf-tgw" } } resource "aws_ec2_transit_gateway_vpc_attachment" "example" { subnet_ids = [aws_subnet.example.id] transit_gateway_id = aws_ec2_transit_gateway.example.id vpc_id = aws_vpc.example.id transit_gateway_default_route_table_association = false tags = { Name = "tf-tgw-vpc-attachment" } } resource "aws_ec2_transit_gateway_route_table" "example" { transit_gateway_id = aws_ec2_transit_gateway.example.id tags = { Name = "tf-rtb" } } resource "aws_ec2_transit_gateway_route_table_association" "example" { transit_gateway_attachment_id = aws_ec2_transit_gateway_vpc_attachment.example.id transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.example.id } ``` -------------------------------- ### Custom PreCheck Example Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/dev-docs/contributing/running-and-writing-acceptance-tests.md Illustrates adding a custom PreCheck function when standard checks are insufficient. This example verifies service existence via a read-only request, suitable for new or preview services. ```go func TestAccExampleThing_basic(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_example_thing.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t), testAccPreCheckExample(t) }, // ... additional checks follow ... }) } func testAccPreCheckExample(t *testing.T) { conn := acctest.Provider.Meta().(*conns.AWSClient).ExampleConn input := &example.ListThingsInput{} _, err := conn.ListThings(input) if testAccPreCheckSkipError(err) { t.Skipf("skipping acceptance testing: %s", err) } if err != nil { t.Fatalf("unexpected PreCheck error: %s", err) } } ``` -------------------------------- ### Example Subnets for EKS Node Group Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/eks_node_group.md This example shows how to define EC2 subnets that can be used with an EKS node group. It utilizes `aws_availability_zones` to get available zones and `cidrsubnet` to create subnet CIDR blocks within a VPC. Tags are applied to associate the subnets with the EKS cluster. ```terraform data "aws_availability_zones" "available" { state = "available" } resource "aws_subnet" "example" { count = 2 availability_zone = data.aws_availability_zones.available.names[count.index] cidr_block = cidrsubnet(aws_vpc.example.cidr_block, 8, count.index) vpc_id = aws_vpc.example.id tags = { "kubernetes.io/cluster/${aws_eks_cluster.example.name}" = "shared" } } ``` -------------------------------- ### Install gRPC-Go Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/google.golang.org/grpc/README.md Add this import to your Go code. The go build command will automatically fetch dependencies. ```go import "google.golang.org/grpc" ``` -------------------------------- ### Get network ACL IDs by tag Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/network_acls.md This example shows how to filter network ACL IDs by a specific tag. It requires the VPC ID and a map of tags to match. ```terraform variable "vpc_id" {} data "aws_network_acls" "example" { vpc_id = var.vpc_id tags = { Tier = "Private" } } ``` -------------------------------- ### ExampleCompany::ExampleService::ExampleResource Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/internal/service/cloudformation/testdata/examplecompany-exampleservice-exampleresource/docs/memo.md Use this resource to manage ExampleCompany ExampleService ExampleResource entities within AWS CloudFormation. ```APIDOC ## ExampleCompany::ExampleService::ExampleResource ### Description This resource allows you to declare and manage an ExampleCompany::ExampleService::ExampleResource entity using AWS CloudFormation. ### Properties #### Heading - **Type**: String - **Required**: No - **Update requires**: No interruption #### Body - **Type**: String - **Required**: No - **Update requires**: No interruption ### Syntax #### JSON ```json { "Heading" : "String", "Body" : "String" } ``` #### YAML ```yaml Heading: String Body: String ``` ``` -------------------------------- ### Wrap String Example in Go Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/mitchellh/go-wordwrap/README.md Demonstrates basic usage of the WrapString function to wrap a given string to a specified width. Ensure the 'fmt' package is imported for printing. ```go wrapped := wordwrap.WrapString("foo bar baz", 3) fmt.Println(wrapped) ``` -------------------------------- ### Cross-Region Acceptance Test Implementation Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/dev-docs/contributing/running-and-writing-acceptance-tests.md Example of an acceptance test function configured for cross-region testing. It includes setup for multiple regions and demonstrates how to handle resources in different AWS regions. ```go func TestAccExample_basic(t *testing.T) { var providers []*schema.Provider resourceName := "aws_example.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) acctest.PreCheckMultipleRegion(t, 2) }, ErrorCheck: acctest.ErrorCheck(t, service.EndpointsID), ProviderFactories: acctest.FactoriesMultipleRegion(&providers, 2), CheckDestroy: testAccCheckExampleDestroy, Steps: []resource.TestStep{ { Config: testAccExampleConfig(), Check: resource.ComposeTestCheckFunc( testAccCheckExampleExists(resourceName), // ... additional checks ... ), }, { Config: testAccExampleConfig(), ResourceName: resourceName, ImportState: true, ImportStateVerify: true, }, }, }) } func testAccExampleConfig() string { return acctest.ConfigMultipleRegionProvider(2) + fmt.Sprintf(` # Cross region resources should be handled by the cross region provider. # The standardized provider is awsalternate as seen below. resource "aws_cross_region_example" "test" { provider = awsalternate # ... configuration ... } # The resource that is the focus of the testing should be handled by the default provider, # which is automatically done by not specifying the provider configuration in the resource. resource "aws_example" "test" { # ... configuration ... } `) } ``` -------------------------------- ### Get subnets with specific tags in a VPC Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/subnets.md This example retrieves subnet IDs within a VPC that have a specific tag key-value pair. It's useful for targeting subnets for specific purposes, like private application tiers. ```terraform variable "vpc_id" {} data "aws_subnets" "private" { filter { name = "vpc-id" values = [var.vpc_id] } tags = { Tier = "Private" } } resource "aws_instance" "app" { for_each = toset(data.aws_subnets.example.ids) ami = "cmi-12345678" # add image id, change instance type if needed instance_type = "m1.micro" subnet_id = each.value } ``` -------------------------------- ### Example Usage: Get Transit Gateway DX Gateway Attachment Info Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/data-sources/ec2_transit_gateway_dx_gateway_attachment.md Use this snippet to fetch information about an existing EC2 transit gateway and Direct Connect gateway attachment by providing their respective IDs. This is useful for referencing attachment details in other resources. ```terraform resource "aws_dx_gateway" "example" { name = "tf-dxgw-example" amazon_side_asn = "64512" } resource "aws_ec2_transit_gateway" "example" { } data "aws_ec2_transit_gateway_dx_gateway_attachment" "selected" { transit_gateway_id = aws_ec2_transit_gateway.example.id dx_gateway_id = aws_dx_gateway.example.id } ``` -------------------------------- ### Build the Provider Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/dev-docs/contributing/development-environment.md Compile the provider plugin. The resulting binary will be placed in the `$GOPATH/bin` directory. ```sh make build ... $GOPATH/bin/terraform-provider-aws ... ``` -------------------------------- ### Check Version Constraints in Go Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/hashicorp/go-version/README.md Shows how to create version constraints and check if a given version satisfies them. Constraints can include ranges and specific versions. ```go v1, err := version.NewVersion("1.2") // Constraints example. constraints, err := version.NewConstraint(">= 1.0, < 1.4") if constraints.Check(v1) { fmt.Printf("%s satisfies constraints %s", v1, constraints) } ``` -------------------------------- ### Passing Resource With Description Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR005/README.md This example shows a correctly configured `schema.Resource` that includes a `Description` field. This configuration will pass the XR005 analyzer checks. ```go &schema.Resource{ Description: "manages a widget", Read: /* ... */, Schema: map[string]*schema.Schema{/* ... */}, } ``` -------------------------------- ### Install msgpack Package Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/providerlint/vendor/github.com/vmihailenco/msgpack/README.md Use this command to install or update the msgpack package to the latest version. ```shell go get -u github.com/vmihailenco/msgpack ``` -------------------------------- ### Example Usage of aws_ec2_transit_gateway Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/ec2_transit_gateway.md This is a basic example of how to create an AWS Transit Gateway with a description and tags. ```terraform resource "aws_ec2_transit_gateway" "example" { description = "tf example" tags = { Name = "tf-tgw" } } ``` -------------------------------- ### Standard Usage Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/ec2_transit_gateway_route.md This example demonstrates the standard configuration for creating a transit gateway route. ```APIDOC ## Resource: aws_ec2_transit_gateway_route Manages a transit gateway route. ### Argument Reference The following arguments are supported: * `blackhole` - (Optional) Indicates whether to drop traffic that matches this route. * _Default value:_ `false` * `destination_cidr_block` - (Required) The CIDR address block used for the destination match. * `transit_gateway_attachment_id` - The ID of the transit gateway attachment. * _Constraints:_ Required if `blackhole` is `false` * `transit_gateway_route_table_id` - (Required) The ID of the transit gateway route table. ### Attribute Reference In addition to all arguments above, the following attributes are exported: * `id` - The ID of the transit gateway route table combined with destination (e.g. `tgw-rtb-12345678_0.0.0.0/0`). ### Import ~> **Note** Only transit gateway routes with `static` type can be imported. The transit gateway route can be imported using `id`, e.g., ``` $ terraform import aws_ec2_transit_gateway_route.example tgw-rtb-12345678_0.0.0.0/0 ``` ``` -------------------------------- ### Basic Usage Source: https://github.com/c2devel/terraform-provider-rockitcloud/blob/develop/docs/resources/subnet.md This example demonstrates the basic usage of the aws_subnet resource, creating a subnet within an existing VPC. ```APIDOC ## Resource: aws_subnet Manages a subnet. ### Example Usage #### Basic Usage ```terraform resource "aws_vpc" "example" { cidr_block = "10.1.0.0/16" } resource "aws_subnet" "example" { vpc_id = aws_vpc.example.id cidr_block = "10.1.1.0/24" tags = { Name = "Main" } } ``` ### Argument Reference The following arguments are supported: * `availability_zone` - (Optional) AZ for the subnet. * `cidr_block` - (Required) The IPv4 CIDR block for the subnet. * `map_public_ip_on_launch` - (Optional) Indicates whether public IP addresses will be associated with instances created in this subnet. Addresses are associated only if there are available allocated Elastic IP addresses. Default is `false`. * `tags` - (Optional) Map of tags to assign to the subnet. If a provider [`default_tags` configuration block][default-tags] is used, tags with matching keys will overwrite those defined at the provider level. * `vpc_id` - (Required) The VPC ID. ### Attribute Reference #### Supported attributes In addition to all arguments above, the following attributes are exported: * `id` - The ID of the subnet * `tags_all` - Map of tags assigned to the subnet, including those inherited from the provider [`default_tags` configuration block][default-tags]. ### Timeouts The `timeouts` block allows you to specify [timeouts] for certain actions: - `create` - (Default `10m`) How long to wait for a subnet to be created. - `delete` - (Default `20m`) How long to wait for a subnet to be deleted. ### Import Subnets can be imported using the `subnet id`, e.g., ``` $ terraform import aws_subnet.public_subnet subnet-12345678 ``` ```