Terraform Basic
Terraform Basic
======================
𝙒𝙝𝙖𝙩 𝙞𝙨 𝙏𝙚𝙧𝙧𝙖𝙛𝙤𝙧𝙢?
- 𝘪𝘯𝘧𝘳𝘢𝘴𝘵𝘳𝘶𝘤𝘵𝘶𝘳𝘦 𝘢𝘴 𝘤𝘰𝘥𝘦 (𝘐𝘢𝘊) 𝘵𝘰𝘰𝘭 𝘵𝘰 𝘥𝘦𝘧𝘪𝘯𝘦, 𝘱𝘳𝘰𝘷𝘪𝘴𝘪𝘰𝘯, 𝘢𝘯𝘥 𝘮𝘢𝘯𝘢𝘨𝘦 𝘤𝘭𝘰𝘶𝘥
𝘢𝘯𝘥 𝘰𝘯-𝘱𝘳𝘦𝘮𝘪𝘴𝘦𝘴 𝘪𝘯𝘧𝘳𝘢𝘴𝘵𝘳𝘶𝘤𝘵𝘶𝘳𝘦 𝘶𝘴𝘪𝘯𝘨 𝘢 𝘥𝘦𝘤𝘭𝘢𝘳𝘢𝘵𝘪𝘷𝘦 𝘤𝘰𝘯𝘧𝘪𝘨𝘶𝘳𝘢𝘵𝘪𝘰𝘯 𝘭𝘢𝘯𝘨𝘶𝘢𝘨𝘦.
-----------------------------------------------------
𝙆𝙚𝙮 𝙗𝙚𝙣𝙚𝙛𝙞𝙩𝙨 𝙤𝙛 𝙪𝙨𝙞𝙣𝙜 𝙏𝙚𝙧𝙧𝙖𝙛𝙤𝙧𝙢:
- 𝘐𝘯𝘧𝘳𝘢𝘴𝘵𝘳𝘶𝘤𝘵𝘶𝘳𝘦 𝘢𝘴 𝘊𝘰𝘥𝘦 (𝘐𝘢𝘊)
- 𝘋𝘦𝘤𝘭𝘢𝘳𝘢𝘵𝘪𝘷𝘦 𝘊𝘰𝘯𝘧𝘪𝘨𝘶𝘳𝘢𝘵𝘪𝘰𝘯
- 𝘔𝘶𝘭𝘵𝘪-𝘊𝘭𝘰𝘶𝘥 𝘢𝘯𝘥 𝘗𝘳𝘰𝘷𝘪𝘥𝘦𝘳 𝘈𝘨𝘯𝘰𝘴𝘵𝘪𝘤
- 𝘚𝘵𝘢𝘵𝘦 𝘔𝘢𝘯𝘢𝘨𝘦𝘮𝘦𝘯𝘵
- 𝘊𝘩𝘢𝘯𝘨𝘦 𝘔𝘢𝘯𝘢𝘨𝘦𝘮𝘦𝘯𝘵
- 𝘈𝘶𝘵𝘰𝘮𝘢𝘵𝘪𝘰𝘯 𝘢𝘯𝘥 𝘊𝘐/𝘊𝘋 𝘐𝘯𝘵𝘦𝘨𝘳𝘢𝘵𝘪𝘰𝘯
- 𝘔𝘰𝘥𝘶𝘭𝘢𝘳 𝘋𝘦𝘴𝘪𝘨𝘯
- 𝘋𝘦𝘱𝘦𝘯𝘥𝘦𝘯𝘤𝘺 𝘔𝘢𝘯𝘢𝘨𝘦𝘮𝘦𝘯𝘵
- 𝘗𝘭𝘢𝘯𝘯𝘪𝘯𝘨 𝘢𝘯𝘥 𝘙𝘦𝘷𝘪𝘦𝘸
----------------------------------------------------
𝘽𝙖𝙨𝙞𝙘 𝙏𝙚𝙧𝙧𝙖𝙛𝙤𝙧𝙢 𝙘𝙤𝙢𝙢𝙖𝙣𝙙𝙨 𝙮𝙤𝙪’𝙡𝙡 𝙪𝙨𝙚 𝙛𝙧𝙚𝙦𝙪𝙚𝙣𝙩𝙡𝙮:
1. 𝙩𝙚𝙧𝙧𝙖𝙛𝙤𝙧𝙢 𝙞𝙣𝙞𝙩
- 𝘗𝘶𝘳𝘱𝘰𝘴𝘦: 𝘐𝘯𝘪𝘵𝘪𝘢𝘭𝘪𝘻𝘦𝘴 𝘢 𝘛𝘦𝘳𝘳𝘢𝘧𝘰𝘳𝘮 𝘸𝘰𝘳𝘬𝘪𝘯𝘨 𝘥𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺.
𝘜𝘴𝘢𝘨𝘦: 𝘛𝘩𝘪𝘴 𝘤𝘰𝘮𝘮𝘢𝘯𝘥 𝘴𝘦𝘵𝘴 𝘶𝘱 𝘵𝘩𝘦 𝘯𝘦𝘤𝘦𝘴𝘴𝘢𝘳𝘺 𝘛𝘦𝘳𝘳𝘢𝘧𝘰𝘳𝘮 𝘤𝘰𝘯𝘧𝘪𝘨𝘶𝘳𝘢𝘵𝘪𝘰𝘯 𝘧𝘰𝘳
𝘺𝘰𝘶𝘳 𝘱𝘳𝘰𝘫𝘦𝘤𝘵, 𝘥𝘰𝘸𝘯𝘭𝘰𝘢𝘥𝘴 𝘱𝘳𝘰𝘷𝘪𝘥𝘦𝘳 𝘱𝘭𝘶𝘨𝘪𝘯𝘴, 𝘢𝘯𝘥 𝘱𝘳𝘦𝘱𝘢𝘳𝘦𝘴 𝘵𝘩𝘦 𝘸𝘰𝘳𝘬𝘪𝘯𝘨
𝘥𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺 𝘧𝘰𝘳 𝘰𝘵𝘩𝘦𝘳 𝘤𝘰𝘮𝘮𝘢𝘯𝘥𝘴.
1. terraform init
2. terraform fmt
3. terraform validate
5. terraform apply
● Purpose: Applies changes required to reach the desired state of the configuration.
● Usage: This command executes the changes necessary to create or update resources
to match the configuration defined in your Terraform files. It prompts for confirmation
before making changes.
6. terraform destroy
● Purpose: Updates the state file with the latest information from the infrastructure.
● Usage: This command updates the Terraform state file with the latest information from
the real infrastructure. It does not modify the infrastructure itself.
● In below example, there is no state available now, because no resources are created.
8. terraform show
9. terraform output
● Purpose: Extracts and displays the output values from the state file.
● Usage: This command displays the values of outputs defined in the Terraform
configuration. Outputs can be used to pass information between Terraform
configurations or for other purposes.
● In below example, there is no state available now, because no resources are created.