User Tools

Site Tools


using_terraform

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
using_terraform [2017/08/05 11:45] walkeradminusing_terraform [2017/08/05 13:56] – [Terraform Apply] walkeradmin
Line 1: Line 1:
 ====== Using Terraform ====== ====== Using Terraform ======
-\\  
 <color darkorange>Aug 2017</color> <color darkorange>Aug 2017</color>
 \\  \\ 
Line 78: Line 77:
 ---- ----
 ==== Terraform Apply ==== ==== Terraform Apply ====
 +\\ 
 +\\ 
 Before starting the Terraform apply option, I suggest you log in to your AWS account so that you can monitor the progress of the script. Before starting the Terraform apply option, I suggest you log in to your AWS account so that you can monitor the progress of the script.
 \\  \\ 
Line 84: Line 85:
 \\  \\ 
 \\  \\ 
-{{ :terraformaws_003.jpg?600 |}}+{{ :terraformaws_003.jpg?700 |}} 
 +\\  
 +In the above example we can see that there is no EC2 Instance configured on this AWS account. There is a default security group that we configured, as well as our key pair. These are both specified in our Terraform script. Remember this script does not create these elements, it just uses them. 
 +\\  
 +\\  
 +If we select Running Instances, then this will be empty (unless you have manually created some.) 
 +\\  
 +\\  
 +{{ :terraformaws_004.jpg?850 |}} 
 +\\  
 +Now we can run our Terraform Script. 
 +\\  
 +\\  
 +In the command window where you ran Terraform Plan, you can now use: 
 +\\  
 +    terraform.exe apply 
 +\\  
 +If you don't have any errors, then you will see an output similar to below: 
 +\\  
 +<file> 
 +aws_instance.example: Creating... 
 +  ami:                          "" => "ami-40a8bf24" 
 +  associate_public_ip_address:  "" => "<computed>" 
 +  availability_zone:            "" => "<computed>" 
 +  ebs_block_device.#:           "" => "<computed>" 
 +  ephemeral_block_device.#:     "" => "<computed>" 
 +  instance_state:               "" => "<computed>" 
 +  instance_type:                "" => "t2.micro" 
 +  ipv6_address_count:           "" => "<computed>" 
 +  ipv6_addresses.#:             "" => "<computed>" 
 +  key_name:                     "" => "TestSvr" 
 +  network_interface.#:          "" => "<computed>" 
 +  network_interface_id:         "" => "<computed>" 
 +  placement_group:              "" => "<computed>" 
 +  primary_network_interface_id: "" => "<computed>" 
 +  private_dns:                  "" => "<computed>" 
 +  private_ip:                   "" => "<computed>" 
 +  public_dns:                   "" => "<computed>" 
 +  public_ip:                    "" => "<computed>" 
 +  root_block_device.#:          "" => "<computed>" 
 +  security_groups.#:            "" => "1" 
 +  security_groups.2525401260:   "" => "launch-wizard-1" 
 +  source_dest_check:            "" => "true" 
 +  subnet_id:                    "" => "<computed>" 
 +  tags.%:                       "" => "1" 
 +  tags.Name:                    "" => "terraform-instance" 
 +  tenancy:                      "" => "<computed>" 
 +  volume_tags.%:                "" => "<computed>" 
 +  vpc_security_group_ids.#:     "" => "<computed>" 
 +aws_instance.example: Still creating... (10s elapsed) 
 +aws_instance.example: Still creating... (20s elapsed) 
 +aws_instance.example: Creation complete (ID: i-0781af6ecb9c0f2f5) 
 + 
 +Apply complete! Resources: 1 added, 0 changed, 0 destroyed. 
 + 
 +The state of your infrastructure has been saved to the path 
 +below. This state is required to modify and destroy your 
 +infrastructure, so keep it safe. To inspect the complete state 
 +use the `terraform show` command. 
 + 
 +State path: 
 +</file> 
 +\\  
 +Now we can check the Running Instances page again. 
 +\\  
 +\\  
 +Initially you will see a status of 'Pending' but this will quickly change to 'Running' 
 +\\  
 +\\  
 +{{ :terraformaws_006.jpg?900 |}} 
 +\\  
 +We can see the following information has been populated according to our Script: 
 +\\  
 +  * Name:                   terraform0Instance 
 +  * Instance Type           t2.micro 
 +  * Availability Zone:      eu-west-2a (yes we only specify eu-west-2, the a/b/c suffix is automatic) 
 +  * Key-Name                TestSvr 
 +\\  
 +The EC2 Instance is now running and using  your key-pair and SSH you should be able to login and start using your virtual machine. 
 +\\  
 +\\  
 + 
 +---- 
 +==== Terraform ==== 
using_terraform.txt · Last modified: 2023/03/09 22:35 by 127.0.0.1