diff --git a/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/compute.tf b/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/compute.tf new file mode 100644 index 0000000..4f0c5e1 --- /dev/null +++ b/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/compute.tf @@ -0,0 +1,26 @@ +resource "aws_network_interface" "foo" { + subnet_id = aws_subnet.example_subnet.id + private_ips = ["172.16.10.100"] + + tags = { + Name = "primary_network_interface" + } +} + +resource "aws_instance" "foo" { + ami = "ami-097df8c5fa681defb" + instance_type = "t2.micro" + + network_interface { + network_interface_id = aws_network_interface.foo.id + device_index = 0 + } + + credit_specification { + cpu_credits = "unlimited" + } + + tags = { + Name = "Main" + } +} \ No newline at end of file diff --git a/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/network.tf b/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/network.tf new file mode 100644 index 0000000..b1d0100 --- /dev/null +++ b/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/network.tf @@ -0,0 +1,17 @@ +resource "aws_vpc" "example_vpc" { + cidr_block = "172.16.0.0/16" + + tags = { + Name = "Main" + } +} + +resource "aws_subnet" "example_subnet" { + vpc_id = aws_vpc.example_vpc.id + cidr_block = "172.16.10.0/24" + availability_zone = "ap-northeast-1a" + + tags = { + Name = "Main" + } +} \ No newline at end of file diff --git a/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/provider.tf b/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/provider.tf new file mode 100644 index 0000000..5744570 --- /dev/null +++ b/infrastructure-as-code/terraform/apps/app1/create-simple-ec2-arch/provider.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "5.53.0" + } + } +} + +provider "aws" { + region = "ap-northeast-1" +} + +resource "aws_vpc" "examplevpc" { + cidr_block = "10.0.0.0/16" +} \ No newline at end of file