A simple OpenTofu (Terraform) workspace for working with a test EC2 instance.
Include the required variables in terraform.tfvars
and run tofu apply
(after initializing).
For an easier way to include the workstation_ip
, run
IP=`curl --silent ifconfig.me`; tofu apply -var workstation_ip=$IP
Example terraform.tfvars
:
ami_name = "Windows_Server-2022-English-Full-Base-*"
instance_type = "t3.large"
name = "testing"
region = "us-west-2"
subnet_id = "subnet-00000000000000000"
vpc_id = "vpc-00000000000000000"
Name | Version |
---|---|
terraform | ~> 1.8 |
aws | ~> 5.0 |
Name | Version |
---|---|
aws | 5.74.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
ami_id | ID of the AMI to use. Overwrites ami_name. | string |
null |
no |
ami_name | Name of the AMI to use (Amazon-owned only). | string |
null |
no |
associate_public_ip_address | Whether to associate a public IP address with the instance. | bool |
false |
no |
get_password_data | Whether to export password data for the instance (usable for Windows instances). | bool |
false |
no |
instance_type | Type (size) of the test instance. | string |
n/a | yes |
name | Name used for test resources. | string |
n/a | yes |
region | AWS region in which to deploy resources. | string |
n/a | yes |
subnet_id | ID of the subnet in which to deploy resources. Overwrites subnet_name. | string |
null |
no |
subnet_name | Name of the subnet to use. | string |
null |
no |
vpc_id | ID of the VPC in which to deploy resources. | string |
n/a | yes |
workstation_ip | IP of workstation used to access the test instance. | string |
n/a | yes |
Name | Description |
---|---|
plaintext_password | Plaintext password for the test instance. |
public_ip | Public IP address of the test instance. |
No modules.
Name | Type |
---|---|
aws_instance.this | resource |
aws_key_pair.this | resource |
aws_security_group.this | resource |
aws_security_group_rule.allow_all_egress | resource |
aws_security_group_rule.allow_workstation_ingress | resource |
aws_ami.this | data source |
aws_subnet.this | data source |