· 7 years ago · Feb 11, 2018, 02:22 AM
1# Terraform Module Output
2
3## Main.tf
4```hcl
5
6variable "access_key" {
7 description = "AWS access key"
8}
9
10variable "secret_key" {
11 description = "AWS secret key"
12}
13
14module "ec2_ldap" {
15 source = "./modules/ec2"
16
17 name = "ldap"
18 access_key = "${var.access_key}"
19 secret_key = "${var.secret_key}"
20}
21```
22
23
24## Console output
25```bash
26PS D:\git\aws-workspace\aws-infrastructure> terraform plan
27Refreshing Terraform state in-memory prior to plan...
28The refreshed state will be used to calculate this plan, but will not be
29persisted to local or remote state storage.
30
31
32------------------------------------------------------------------------
33
34An execution plan has been generated and is shown below.
35Resource actions are indicated with the following symbols:
36 + create
37
38Terraform will perform the following actions:
39
40 + module.ec2_ldap.aws_instance.centos
41 id: <computed>
42 ami: "ami-6e28b517"
43 associate_public_ip_address: <computed>
44 availability_zone: "eu-west-1a"
45 ebs_block_device.#: <computed>
46 ephemeral_block_device.#: <computed>
47 instance_state: <computed>
48 instance_type: "t2.micro"
49 ipv6_address_count: <computed>
50 ipv6_addresses.#: <computed>
51 key_name: <computed>
52 network_interface.#: <computed>
53 network_interface_id: <computed>
54 placement_group: <computed>
55 primary_network_interface_id: <computed>
56 private_dns: <computed>
57 private_ip: <computed>
58 public_dns: <computed>
59 public_ip: <computed>
60 root_block_device.#: <computed>
61 security_groups.#: <computed>
62 source_dest_check: "true"
63 subnet_id: <computed>
64 tags.%: "1"
65 tags.Name: "ldap"
66 tenancy: <computed>
67 volume_tags.%: <computed>
68 vpc_security_group_ids.#: <computed>
69
70
71Plan: 1 to add, 0 to change, 0 to destroy.
72
73------------------------------------------------------------------------
74
75Note: You didn't specify an "-out" parameter to save this plan, so Terraform
76can't guarantee that exactly these actions will be performed if
77"terraform apply" is subsequently run.
78```
79
80## Directory content
81
82```bash
83PS D:\git\aws-workspace\aws-infrastructure> ls -Recurse -Attributes a
84
85
86 Directory: D:\git\aws-workspace\aws-infrastructure
87
88
89Mode LastWriteTime Length Name
90---- ------------- ------ ----
91-a---- 27/01/2018 13:55 166 .gitignore
92-a---- 27/01/2018 14:03 281 main.tf
93-a---- 27/01/2018 13:25 142 README.md
94-a---- 27/01/2018 13:55 92 terraform.tfvars
95
96
97 Directory: D:\git\aws-workspace\aws-infrastructure\.terraform\modules
98
99
100Mode LastWriteTime Length Name
101---- ------------- ------ ----
102-a---- 27/01/2018 13:25 55 10ccbc1a60ce2fdc78e34efeb7513613
103-a---- 27/01/2018 13:47 158 modules.json
104
105
106 Directory: D:\git\aws-workspace\aws-infrastructure\.terraform\plugins\windows_amd64
107
108
109Mode LastWriteTime Length Name
110---- ------------- ------ ----
111-a---- 27/01/2018 13:47 79 lock.json
112-a---- 27/01/2018 13:47 66967040 terraform-provider-aws_v1.7.1_x4.exe
113
114
115 Directory: D:\git\aws-workspace\aws-infrastructure\modules\ec2
116
117
118Mode LastWriteTime Length Name
119---- ------------- ------ ----
120-a---- 27/01/2018 14:03 393 main.tf
121-a---- 27/01/2018 14:03 73 outputs.tf
122-a---- 27/01/2018 13:28 487 README.md
123-a---- 27/01/2018 14:02 577 variables.tf
124```