Difference between revisions of "AWS instance example creating VPC"
Jump to navigation
Jump to search
(Created page with "<pre> provider "aws" { access_key = "ACCESS_KEY_HERE" secret_key = "SECRET_KEY_HERE" region = "us-east-1" } resource "aws_instance" "example" { ami = "ami-2757f631"...") |
|||
Line 1: | Line 1: | ||
+ | |||
+ | [[provider]] "aws" { | ||
+ | access_key = "ACCESS_KEY_HERE" | ||
+ | secret_key = "SECRET_KEY_HERE" | ||
+ | region = "us-east-1" | ||
+ | } | ||
+ | |||
+ | resource "aws_instance" "example" { | ||
+ | ami = "ami-2757f631" | ||
+ | instance_type = "t2.micro" | ||
+ | subnet_id = "${aws_subnet.us-east-1a-public.id}" | ||
+ | } | ||
<pre> | <pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
resource "aws_vpc" "example" { | resource "aws_vpc" "example" { | ||
cidr_block = "10.0.0.0/16" | cidr_block = "10.0.0.0/16" |
Revision as of 03:06, 2 February 2022
provider "aws" { access_key = "ACCESS_KEY_HERE" secret_key = "SECRET_KEY_HERE" region = "us-east-1" } resource "aws_instance" "example" { ami = "ami-2757f631" instance_type = "t2.micro" subnet_id = "${aws_subnet.us-east-1a-public.id}" }
resource "aws_vpc" "example" { cidr_block = "10.0.0.0/16" enable_dns_hostnames = true enable_dns_support = true } resource "aws_subnet" "us-east-1a-public" { vpc_id = "${aws_vpc.example.id}" cidr_block = "10.0.1.0/25" availability_zone = "us-east-1a" }
See also
- Terraform, OpenTofu, Terrakube.org, Installation, Terraform AWS, Terraform GCP, Terraform commands, Terraform Cloud, Terraform Enterprise (TFE), HCL, HIL, meta-arguments, providers, modules, resource, provisioners, data sources, backends: remote backends, examples, configuration files, state files, variables, types, Terraform Registry, conditionals:
depends_on
, functions, Blocks, dynamic blocks, errors, Terragrunt, Terraformer, Terratest, Terraform certifications, Terraform map type, Terraform Associate, Terraform: list type,TF_VAR_, TF_LOG
, Terraform provider versioning, Terraform Style Conventions, Required version, Terraform plugin, Terraform Named Values, tags, Changelog,tfsec, tflint
, Operators, Expressions:for, splat
, Debugging, Namespaces, Terraform Landing Zones, CDKTF, Atmos
Advertising: