first commit

This commit is contained in:
古川 一之輔 2025-07-03 17:24:43 +09:00
commit 8f23ccebb1
121 changed files with 41040 additions and 0 deletions

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAvRgNiwRozl2Qp1PITKHCoHJ1ho7pxxbil3n9g4Il5j5cQeUP
u/prDIHWfZYlS/yqMOo4JCAmhjFCMTzc1VSe9S7/WPF6wR05nEuxW0f7H/blIbn2
PazOxncEoVQy/cNOZSNevRMmv938tK/cfFxZt06Z72ahvMy0wZsCHA7jtu4o1mar
oNIHc16/L2ydzZBFPhE4yhDXXDHMFnLuMrjpULSa7OQijqu4d6RHmNig2Va4ktFS
yRDzoXPlBP1vqm2KELWNxv0s1odx+12TDZuubH1VMtumP79oidiLB4jT5tfFJJBK
Qd8j+Y4iMksewLxVTJBetAUUz6cqDNl33Qe+bQIDAQABAoIBAAFybSwaqQinO6Ok
Jvy7IiejKJYSguR0nuBE3TVD6jFUWdVhQNkR5f7PAYqtevSVZuH/8NUJ7/GH7/c7
fX8eaib7KJYQJv3SUO4KwD0wFFJey8sRxrobF+v53i2z3L4HYBKzDhcJTfsa4kOp
sti6xi76aYAk+2jb8ignHQGE9aYhMg0J3dQOZyGR/P/I7F1gDZuDOF4ioSnSUkWQ
l/y1P5HSXKfnklslaxJoc/izhP9kJEVEYc5avCMOEPm9CBllGmVwT/uTycxJEoLk
EoeHeKkZXelJWExt7RTYEfhRO1zWOFmdlxBFSdlL6rycuQ6n6MR1sLU0GPJdUI2O
z+ZiKRECgYEA0xT2ceN2p7vPZbcgdXAYVWzyXiP7eJl1Wczsn7WExB0dbMHXJmw2
v8rrK7uJ3bVFeUmN4pZ1DYRsz+sc+WYr+vZ3ZW175chA0cPsu6L5KA2RwTYNRqkw
15dnBRD5fGcL6pJ8l1yPrlqWbpHreNd6AS3u02LNHfWecKdfOYf4KjkCgYEA5VVC
3J5bBeNmOKkWOhRCF1g6Oatx3iXGWlpwVHXv2yXXxBwhhp2YVm8y6sffYOvYP1Uu
eMFDl5vGfhog3SndGnBnzQgzv//LMjq3U6nuvjssZvzuO/hzwtXHoddRe7UZGCp7
fNtuiXxgE1MO6FV+27dIYcSvFP0fe3CFfs6FhdUCgYEAqpVfUMy1YHp78kSbO60a
TTcda40CtgS2fJsKg0srf13UIMdKO2fqmva/NPl7QiwzeABEZOCYuhLR6Pml0buL
QWabOOHQ5fL+x0bh8wWS+5Zzu0QWWIt0yFY30DVWmf2g+LHndF8+UnYs6jCMrnzc
wUVAo55OC68qmvn4D8Ndf6kCgYBL4dNW1pr9rsmjE+fD3fIkcVAKxvzNaahhOy2R
9Nghpjrnq/s35KuEZhTt9KaoFkGeaxwOXrxzzNp33UNkirabSfg+smkVLZlZjG4e
o8rYbRH7HdPiSgpbvIrqtSlECp88DMqBfMXtfhb4LfJv0+I+5z1vBDp+cmbZXFj/
pWwu5QKBgQDAlBt94fcf0txi+l5ccj3f0MZC28TtBgGK+pAmaQtGQaDDFS5KJvfW
o2FuZHziwP7y6uSqNOEmdWcrbJmPRGLNciOobCyKSPKykXOLtU+k6hIEonHuNnzz
n1LmHTzht6EMT/eVJDkU7ws8v6wIFdFiL40alVH7tGBTgzgpcYUjRg==
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,29 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdz
c2gtcnNhAAAAAwEAAQAAAQEAvRgNiwRozl2Qp1PITKHCoHJ1ho7pxxbil3n9g4Il
5j5cQeUPu/prDIHWfZYlS/yqMOo4JCAmhjFCMTzc1VSe9S7/WPF6wR05nEuxW0f7
H/blIbn2PazOxncEoVQy/cNOZSNevRMmv938tK/cfFxZt06Z72ahvMy0wZsCHA7j
tu4o1maroNIHc16/L2ydzZBFPhE4yhDXXDHMFnLuMrjpULSa7OQijqu4d6RHmNig
2Va4ktFSyRDzoXPlBP1vqm2KELWNxv0s1odx+12TDZuubH1VMtumP79oidiLB4jT
5tfFJJBKQd8j+Y4iMksewLxVTJBetAUUz6cqDNl33Qe+bQAAA7hSOo//UjqP/wAA
AAdzc2gtcnNhAAABAQC9GA2LBGjOXZCnU8hMocKgcnWGjunHFuKXef2DgiXmPlxB
5Q+7+msMgdZ9liVL/Kow6jgkICaGMUIxPNzVVJ71Lv9Y8XrBHTmcS7FbR/sf9uUh
ufY9rM7GdwShVDL9w05lI169Eya/3fy0r9x8XFm3TpnvZqG8zLTBmwIcDuO27ijW
Zqug0gdzXr8vbJ3NkEU+ETjKENdcMcwWcu4yuOlQtJrs5CKOq7h3pEeY2KDZVriS
0VLJEPOhc+UE/W+qbYoQtY3G/SzWh3H7XZMNm65sfVUy26Y/v2iJ2IsHiNPm18Uk
kEpB3yP5jiIySx7AvFVMkF60BRTPpyoM2XfdB75tAAAAAwEAAQAAAQABcm0sGqkI
pzujpCb8uyInoyiWEoLkdJ7gRN01Q+oxVFnVYUDZEeX+zwGKrXr0lWbh//DVCe/x
h+/3O31/Hmom+yiWECb90lDuCsA9MBRSXsvLEca6Gxfr+d4ts9y+B2ASsw4XCU37
GuJDqbLYusYu+mmAJPto2/IoJx0BhPWmITINCd3UDmchkfz/yOxdYA2bgzheIqEp
0lJFkJf8tT+R0lyn55JbJWsSaHP4s4T/ZCRFRGHOWrwjDhD5vQgZZRplcE/7k8nM
SRKC5BKHh3ipGV3pSVhMbe0U2BH4UTtc1jhZnZcQRUnZS+q8nLkOp+jEdbC1NBjy
XVCNjs/mYikRAAAAgQDAlBt94fcf0txi+l5ccj3f0MZC28TtBgGK+pAmaQtGQaDD
FS5KJvfWo2FuZHziwP7y6uSqNOEmdWcrbJmPRGLNciOobCyKSPKykXOLtU+k6hIE
onHuNnzzn1LmHTzht6EMT/eVJDkU7ws8v6wIFdFiL40alVH7tGBTgzgpcYUjRgAA
AIEA0xT2ceN2p7vPZbcgdXAYVWzyXiP7eJl1Wczsn7WExB0dbMHXJmw2v8rrK7uJ
3bVFeUmN4pZ1DYRsz+sc+WYr+vZ3ZW175chA0cPsu6L5KA2RwTYNRqkw15dnBRD5
fGcL6pJ8l1yPrlqWbpHreNd6AS3u02LNHfWecKdfOYf4KjkAAACBAOVVQtyeWwXj
ZjipFjoUQhdYOjmrcd4lxlpacFR179sl18QcIYadmFZvMurH32Dr2D9VLnjBQ5eb
xn4aIN0p3RpwZ80IM7//yzI6t1Op7r47LGb87jv4c8LVx6HXUXu1GRgqe3zbbol8
YBNTDuhVftu3SGHErxT9H3twhX7OhYXVAAAAAAEC
-----END OPENSSH PRIVATE KEY-----

82
CMDB/.terraform.lock.hcl Normal file
View File

@ -0,0 +1,82 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.54.1"
constraints = "~> 5.54.1"
hashes = [
"h1:SOdZNOAcBvbrkV6V1S7UiGh9K//O66qfyXpHgyXeBeI=",
"zh:37c09b9a0a0a2f7854fe52c6adb15f71593810b458a8283ed71d68036af7ba3a",
"zh:42fe11d87723d4e43b9c6224ae6bacdcb53faee8abc58f0fc625a161d1f71cb1",
"zh:57c6dfc46f28c9c2737559bd84acbc05aeae90431e731bb72a0024028a2d2412",
"zh:5ba9665a4ca0e182effd75575b19a4d47383ec02662024b9fe26f78286c36619",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:b55980be0237644123a02a30b56d4cc03863ef29036c47d6e8ab5429ab45adf5",
"zh:b81e7664f10855a3a6fc234a18b4c4f1456273126a40c41516f2061696fb9870",
"zh:bd09736ffafd92af104c3c34b5add138ae8db4402eb687863ce472ca7e5ff2e2",
"zh:cc2eb1c62fba2a11d1f239e650cc2ae94bcab01c907384dcf2e213a6ee1bd5b2",
"zh:e5dc40205d9cf6f353c0ca532ae29afc6c83928bc9bcca47d74b640d3bb5a38c",
"zh:ebf1acdcd13f10db1b9c85050ddaadc70ab269c47c5a240753362446442d8371",
"zh:f2fc28a4ad94af5e6144a7309286505e3eb7a94d9dc106722b506c372ff7f591",
"zh:f49445e8435944df122aa89853260a2716ba8b73d6a6a70cae1661554926d5a2",
"zh:fc3b5046e60ae7cab20715be23de8436eb12736136fd6d0f0cc1549ebda6cc73",
"zh:fdb98a53500e245a3b5bec077b994da6959dba8fc4eb7534528658d820e06bd5",
]
}
provider "registry.terraform.io/hashicorp/http" {
version = "3.5.0"
hashes = [
"h1:8bUoPwS4hahOvzCBj6b04ObLVFXCEmEN8T/5eOHmWOM=",
"zh:047c5b4920751b13425efe0d011b3a23a3be97d02d9c0e3c60985521c9c456b7",
"zh:157866f700470207561f6d032d344916b82268ecd0cf8174fb11c0674c8d0736",
"zh:1973eb9383b0d83dd4fd5e662f0f16de837d072b64a6b7cd703410d730499476",
"zh:212f833a4e6d020840672f6f88273d62a564f44acb0c857b5961cdb3bbc14c90",
"zh:2c8034bc039fffaa1d4965ca02a8c6d57301e5fa9fff4773e684b46e3f78e76a",
"zh:5df353fc5b2dd31577def9cc1a4ebf0c9a9c2699d223c6b02087a3089c74a1c6",
"zh:672083810d4185076c81b16ad13d1224b9e6ea7f4850951d2ab8d30fa6e41f08",
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
"zh:7b4200f18abdbe39904b03537e1a78f21ebafe60f1c861a44387d314fda69da6",
"zh:843feacacd86baed820f81a6c9f7bd32cf302db3d7a0f39e87976ebc7a7cc2ee",
"zh:a9ea5096ab91aab260b22e4251c05f08dad2ed77e43e5e4fadcdfd87f2c78926",
"zh:d02b288922811739059e90184c7f76d45d07d3a77cc48d0b15fd3db14e928623",
]
}
provider "registry.terraform.io/hashicorp/local" {
version = "2.5.3"
hashes = [
"h1:1Nkh16jQJMp0EuDmvP/96f5Unnir0z12WyDuoR6HjMo=",
"zh:284d4b5b572eacd456e605e94372f740f6de27b71b4e1fd49b63745d8ecd4927",
"zh:40d9dfc9c549e406b5aab73c023aa485633c1b6b730c933d7bcc2fa67fd1ae6e",
"zh:6243509bb208656eb9dc17d3c525c89acdd27f08def427a0dce22d5db90a4c8b",
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
"zh:885d85869f927853b6fe330e235cd03c337ac3b933b0d9ae827ec32fa1fdcdbf",
"zh:bab66af51039bdfcccf85b25fe562cbba2f54f6b3812202f4873ade834ec201d",
"zh:c505ff1bf9442a889ac7dca3ac05a8ee6f852e0118dd9a61796a2f6ff4837f09",
"zh:d36c0b5770841ddb6eaf0499ba3de48e5d4fc99f4829b6ab66b0fab59b1aaf4f",
"zh:ddb6a407c7f3ec63efb4dad5f948b54f7f4434ee1a2607a49680d494b1776fe1",
"zh:e0dafdd4500bec23d3ff221e3a9b60621c5273e5df867bc59ef6b7e41f5c91f6",
"zh:ece8742fd2882a8fc9d6efd20e2590010d43db386b920b2a9c220cfecc18de47",
"zh:f4c6b3eb8f39105004cf720e202f04f57e3578441cfb76ca27611139bc116a82",
]
}
provider "registry.terraform.io/hashicorp/tls" {
version = "4.1.0"
hashes = [
"h1:Ka8mEwRFXBabR33iN/WTIEW6RP0z13vFsDlwn11Pf2I=",
"zh:14c35d89307988c835a7f8e26f1b83ce771e5f9b41e407f86a644c0152089ac2",
"zh:2fb9fe7a8b5afdbd3e903acb6776ef1be3f2e587fb236a8c60f11a9fa165faa8",
"zh:35808142ef850c0c60dd93dc06b95c747720ed2c40c89031781165f0c2baa2fc",
"zh:35b5dc95bc75f0b3b9c5ce54d4d7600c1ebc96fbb8dfca174536e8bf103c8cdc",
"zh:38aa27c6a6c98f1712aa5cc30011884dc4b128b4073a4a27883374bfa3ec9fac",
"zh:51fb247e3a2e88f0047cb97bb9df7c228254a3b3021c5534e4563b4007e6f882",
"zh:62b981ce491e38d892ba6364d1d0cdaadcee37cc218590e07b310b1dfa34be2d",
"zh:bc8e47efc611924a79f947ce072a9ad698f311d4a60d0b4dfff6758c912b7298",
"zh:c149508bd131765d1bc085c75a870abb314ff5a6d7f5ac1035a8892d686b6297",
"zh:d38d40783503d278b63858978d40e07ac48123a2925e1a6b47e62179c046f87a",
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
"zh:fb07f708e3316615f6d218cec198504984c0ce7000b9f1eebff7516e384f4b54",
]
}

View File

@ -0,0 +1,375 @@
Copyright (c) 2017 HashiCorp, Inc.
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View File

@ -0,0 +1,375 @@
Copyright (c) 2017 HashiCorp, Inc.
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View File

@ -0,0 +1,375 @@
Copyright (c) 2017 HashiCorp, Inc.
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View File

@ -0,0 +1,375 @@
Copyright (c) 2017 HashiCorp, Inc.
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

3
CMDB/README.md Normal file
View File

@ -0,0 +1,3 @@
# CMDB Provisioning
構成管理サーバーの環境構築を行うコードです。

105
CMDB/ec2.bak Normal file
View File

@ -0,0 +1,105 @@
# ---------------------------
# EC2 Keypairの設定
# ---------------------------
# 鍵の名前を指定
variable "key_name" {
default = "cmdb-keypair"
}
# 秘密鍵のアルゴリズム設定
resource "tls_private_key" "cmdb_private_key" {
algorithm = "RSA"
rsa_bits = 2048
}
# 生成するkeypair秘密鍵と公開鍵のパスを指定
locals {
public_key_file = "./.keypair/${var.key_name}.id_rsa.pub"
private_key_file = "./.keypair/${var.key_name}.id_rsa"
}
# 鍵の生成
resource "local_file" "cmdb_private_key_pem" {
filename = local.private_key_file
content = tls_private_key.cmdb_private_key.private_key_pem
}
# 公開鍵をAWSのkeypairにインポート
resource "aws_key_pair" "cmdb_keypair" {
key_name = var.key_name
public_key = tls_private_key.cmdb_private_key.public_key_openssh
}
# ---------------------------
# EC2 インスタンス
# ---------------------------
# Amazon Linux2のAMIを取得
data "aws_ssm_parameter" "amazon_linux2023" {
name = "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64"
}
# ネットワークインターフェイスの作成
resource "aws_network_interface" "cmdb_ni_web1" {
subnet_id = aws_subnet.cmdb_public_1a_subnet.id
private_ips = ["10.5.1.10"]
# セキュリティグループの指定
security_groups = [aws_security_group.cmdb_ec2_sg.id]
tags = {
Name = "cmdb-ni-web1"
}
}
resource "aws_network_interface" "cmdb_ni_web2" {
subnet_id = aws_subnet.cmdb_public_1c_subnet.id
private_ips = ["10.5.3.10"]
# セキュリティグループの指定
security_groups = [aws_security_group.cmdb_ec2_sg.id]
tags = {
Name = "cmdb-ni-web2"
}
}
# EC2インスタンスの作成
resource "aws_instance" "cmdb_ec2" {
# AMIの指定
ami = data.aws_ssm_parameter.amazon_linux2023.value
# インスタンスタイプの指定
instance_type = "t3a.medium"
# EBSのルートボリューム設定
root_block_device {
# ボリュームサイズ(GiB)
volume_size = 64
# ボリュームタイプ
volume_type = "gp3"
# GP3のIOPS
iops = 3000
# GP3のスループット
throughput = 125
# EC2終了時に削除
delete_on_termination = true
# EBSのNameタグ
tags = {
Name = "gp3-dev-ec2"
}
}
# アベイラビリティーゾーンの指定
availability_zone = "ap-northeast-1a"
# サブネットの指定 : NICの設定と重複するため不要
# subnet_id = aws_subnet.cmdb_public_1a_subnet.id
# ネットワークインターフェイスの指定
network_interface {
network_interface_id = aws_network_interface.cmdb_ni_web1.id
device_index = 0
}
# キーペアの指定
key_name = var.key_name
# インスタンスプロファイルの指定
iam_instance_profile = aws_iam_instance_profile.cmdb_ssm_instance_profile.name
# user dataの指定CMDBのインストール
user_data = file("install.sh")
tags = {
Name = "cmdb-ec2"
}
}

111
CMDB/ec2.tf Normal file
View File

@ -0,0 +1,111 @@
# ---------------------------
# EC2 Keypairの設定
# ---------------------------
#
variable "key_name" {
default = "cmdb-keypair"
}
#
resource "tls_private_key" "keygen" {
algorithm = "RSA"
rsa_bits = 2048
}
# keypair
locals {
public_key_file = "./.keypair/${var.key_name}.id_rsa.pub"
private_key_file = "./.keypair/${var.key_name}.id_rsa"
}
#
resource "local_file" "cmdb_private_key_pem" {
filename = local.private_key_file
content = tls_private_key.keygen.private_key_pem
}
resource "local_file" "cmdb_public_key_pem" {
filename = local.public_key_file
content = tls_private_key.keygen.private_key_openssh
}
# AWSのkeypairにインポート
resource "aws_key_pair" "cmdb_keypair" {
key_name = var.key_name
public_key = tls_private_key.keygen.public_key_openssh
}
# ---------------------------
# EC2
# ---------------------------
# Amazon Linux2のAMIを取得
data "aws_ssm_parameter" "amazon_linux2023" {
name = "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64"
}
#
resource "aws_network_interface" "cmdb_ni_web1" {
subnet_id = aws_subnet.cmdb_public_1a_subnet.id
private_ips = ["10.5.1.10"]
#
security_groups = [aws_security_group.cmdb_ec2_sg.id]
tags = {
Name = "cmdb-ni-web1"
}
}
resource "aws_network_interface" "cmdb_ni_web2" {
subnet_id = aws_subnet.cmdb_public_1c_subnet.id
private_ips = ["10.5.3.10"]
#
security_groups = [aws_security_group.cmdb_ec2_sg.id]
tags = {
Name = "cmdb-ni-web2"
}
}
# EC2インスタンスの作成
resource "aws_instance" "cmdb_ec2" {
# AMIの指定
ami = data.aws_ssm_parameter.amazon_linux2023.value
#
instance_type = "t3a.medium"
# EBSのルートボリューム設定
root_block_device {
# (GiB)
volume_size = 64
#
volume_type = "gp3"
# GP3のIOPS
iops = 3000
# GP3のスループット
throughput = 125
# EC2終了時に削除
delete_on_termination = true
# EBSのNameタグ
tags = {
Name = "gp3-dev-ec2"
}
}
#
disable_api_termination = true
#
availability_zone = "ap-northeast-1a"
# : NICの設定と重複するため不要
# subnet_id = aws_subnet.cmdb_public_1a_subnet.id
#
network_interface {
network_interface_id = aws_network_interface.cmdb_ni_web1.id
device_index = 0
}
#
key_name = var.key_name
#
iam_instance_profile = aws_iam_instance_profile.cmdb_ssm_instance_profile.name
# user dataCMDBのインストール
user_data = file("install.sh")
tags = {
Name = "cmdb-ec2"
}
}

37
CMDB/iam.tf Normal file
View File

@ -0,0 +1,37 @@
# ---------------------------
# IAMポリシー
# ---------------------------
# EC2に接続できるようにする
#
data "aws_iam_policy_document" "cmdb_assume_role_for_ec2" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["ec2.amazonaws.com"]
}
}
}
# SSMの許可ポリシーを取得
data "aws_iam_policy" "cmdb_ssm_core" {
name = "AmazonSSMManagedInstanceCore"
}
# IAMロールの作成
resource "aws_iam_role" "cmdb_ssm_role" {
name = "cmdb-ssm-role"
assume_role_policy = data.aws_iam_policy_document.cmdb_assume_role_for_ec2.json
}
#
resource "aws_iam_role_policy_attachment" "cmdb_ssm_policy_attachment" {
role = aws_iam_role.cmdb_ssm_role.name
policy_arn = data.aws_iam_policy.cmdb_ssm_core.arn
}
# EC2に設定するためのインスタンスプロファイルを作成
resource "aws_iam_instance_profile" "cmdb_ssm_instance_profile" {
name = "cmdb-ssm-instance-profile"
role = aws_iam_role.cmdb_ssm_role.name
}

43
CMDB/install.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/bash
dnf update -y
dnf install -y httpd wget php-fpm php-mysqli php-json php php-devel mariadb105 tree
wget http://ja.wordpress.org/latest-ja.tar.gz -P /tmp/
tar zxvf /tmp/latest-ja.tar.gz -C /tmp
cp -r /tmp/wordpress/* /var/www/html/
chown apache:apache -R /var/www/html
systemctl enable httpd.service
systemctl start httpd.service
dnf update
dnf -y install ansible
cd /tmp
curl -O https://releases.hashicorp.com/terraform/1.9.5/terraform_1.9.5_linux_amd64.zip
unzip terraform_1.9.5_linux_amd64.zip
mv terraform /usr/local/bin/
terraform -install-autocomplete
chmod +x /usr/local/bin/terraform
dnf -y install docker
systemctl start docker
systemctl enable docker
usermod -a -G docker ec2-user
chgrp docker /var/run/docker.sock
mkdir -p /usr/local/bin/docker/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-linux-x86_64 -o /usr/local/bin/docker/cli-plugins/docker-compose
chmod +x /usr/local/bin/docker/cli-plugins/docker-compose
ln -s /usr/local/bin/docker/cli-plugins/docker-compose /usr/bin/docker-compose
localectl set-locale LANG=ja_JP.utf8
timedatectl set-timezone Asia/Tokyo
mkdir -p /opt/docker/jenkins
chown -R ec2-user:docker /opt/docker
cd /opt/docker
mkdir gitea
mkdir proxy

19
CMDB/main.tf Normal file
View File

@ -0,0 +1,19 @@
# ---------------------------
#
# ---------------------------
# AWS
provider "aws" {
region = "ap-northeast-1"
}
# IP取得用
provider "http" {}
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.54.1"
}
}
}

4
CMDB/output.tf Normal file
View File

@ -0,0 +1,4 @@
# RDSのアドレスを出力
output "cmdb_rds_address" {
value = aws_db_instance.cmdb_rds.address
}

41
CMDB/rds.tf Normal file
View File

@ -0,0 +1,41 @@
# ---------------------------
# RDS
# ---------------------------
# DBサブネットグループの作成
resource "aws_db_subnet_group" "cmdb_db_subnet_group" {
name = "cmdb-db-subnet-group"
subnet_ids = [
aws_subnet.cmdb_private_1a_subnet.id,
aws_subnet.cmdb_private_1c_subnet.id
]
tags = {
Name = "cmdb-db-subnet-group"
}
}
# RDSインスタンスの作成
resource "aws_db_instance" "cmdb_rds" {
identifier = "cmdb-rds"
#
instance_class = "db.t3.micro"
allocated_storage = 20
# DBサブネットグループの指定
db_subnet_group_name = aws_db_subnet_group.cmdb_db_subnet_group.name
#
vpc_security_group_ids = [aws_security_group.cmdb_rds_sg.id]
# AZインスタンスの設定
multi_az = false
# DBエンジンの指定
engine = "mysql"
engine_version = "8.0.35"
# DB情報の設定
db_name = "wordpress"
username = "admin"
password = "passw0rd!"
#
apply_immediately = true
# DB削除時にスナップショットを作成しない
skip_final_snapshot = true
# 0
backup_retention_period = "10"
}

1491
CMDB/terraform.tfstate Normal file

File diff suppressed because it is too large Load Diff

196
CMDB/vpc.tf Normal file
View File

@ -0,0 +1,196 @@
# ---------------------------
# VPC
# ---------------------------
resource "aws_vpc" "cmdb-vpc" {
cidr_block = "10.5.0.0/16"
enable_dns_hostnames = true # DNSホスト名を有効化
tags = {
Name = "cmdb-vpc"
}
}
# ---------------------------
#
# ---------------------------
# 1
resource "aws_subnet" "cmdb_public_1a_subnet" {
vpc_id = aws_vpc.cmdb-vpc.id
cidr_block = "10.5.1.0/24"
availability_zone = "ap-northeast-1a"
map_public_ip_on_launch = true
tags = {
Name = "cmdb-public-1a-subnet"
}
}
# 2
resource "aws_subnet" "cmdb_public_1c_subnet" {
vpc_id = aws_vpc.cmdb-vpc.id
cidr_block = "10.5.3.0/24"
availability_zone = "ap-northeast-1c"
map_public_ip_on_launch = true
tags = {
Name = "cmdb-public-1c-subnet"
}
}
# 1
resource "aws_subnet" "cmdb_private_1a_subnet" {
vpc_id = aws_vpc.cmdb-vpc.id
cidr_block = "10.5.2.0/24"
availability_zone = "ap-northeast-1a"
tags = {
Name = "cmdb-private-1a-subnet"
}
}
# 2
resource "aws_subnet" "cmdb_private_1c_subnet" {
vpc_id = aws_vpc.cmdb-vpc.id
cidr_block = "10.5.4.0/24"
availability_zone = "ap-northeast-1c"
tags = {
Name = "cmdb-private-1c-subnet"
}
}
# ---------------------------
#
# ---------------------------
resource "aws_internet_gateway" "cmdb_igw" {
vpc_id = aws_vpc.cmdb-vpc.id
tags = {
Name = "cmdb-igw"
}
}
# ---------------------------
#
# ---------------------------
#
resource "aws_route_table" "cmdb_public_rtb" {
vpc_id = aws_vpc.cmdb-vpc.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.cmdb_igw.id
}
tags = {
Name = "cmdb-public-rtb"
}
}
# 1
resource "aws_route_table_association" "cmdb_public_1a_rtb_associate" {
subnet_id = aws_subnet.cmdb_public_1a_subnet.id
route_table_id = aws_route_table.cmdb_public_rtb.id
}
# 2
resource "aws_route_table_association" "cmdb_public_1c_rtb_associate" {
subnet_id = aws_subnet.cmdb_public_1c_subnet.id
route_table_id = aws_route_table.cmdb_public_rtb.id
}
# ---------------------------
#
# ---------------------------
# EC2用
resource "aws_security_group" "cmdb_ec2_sg" {
name = "cmdb-ec2-sg"
description = "for ec2"
vpc_id = aws_vpc.cmdb-vpc.id
tags = {
Name = "cmdb-ec2-sg"
}
}
# RDS用
resource "aws_security_group" "cmdb_rds_sg" {
name = "cmdb-rds-sg"
description = "for rds"
vpc_id = aws_vpc.cmdb-vpc.id
tags = {
Name = "cmdb-rds-sg"
}
}
# ---------------------------
#
# ---------------------------
# EC2用インバウンドルール ssh
resource "aws_vpc_security_group_ingress_rule" "cmdb_ec2_sg_allow_ssh" {
security_group_id = aws_security_group.cmdb_ec2_sg.id
cidr_ipv4 = "0.0.0.0/0"
from_port = 22
to_port = 22
ip_protocol = "tcp"
}
# EC2用インバウンドルール http
resource "aws_vpc_security_group_ingress_rule" "cmdb_ec2_sg_allow_http" {
security_group_id = aws_security_group.cmdb_ec2_sg.id
cidr_ipv4 = "0.0.0.0/0"
from_port = 80
to_port = 80
ip_protocol = "tcp"
}
# EC2用インバウンドルール https
resource "aws_vpc_security_group_ingress_rule" "cmdb_ec2_sg_allow_https" {
security_group_id = aws_security_group.cmdb_ec2_sg.id
cidr_ipv4 = "0.0.0.0/0"
from_port = 443
to_port = 443
ip_protocol = "tcp"
}
# EC2用インバウンドルール smtps
resource "aws_vpc_security_group_ingress_rule" "cmdb_ec2_sg_allow_smtps" {
security_group_id = aws_security_group.cmdb_ec2_sg.id
cidr_ipv4 = "0.0.0.0/0"
from_port = 465
to_port = 465
ip_protocol = "tcp"
}
# EC2用インバウンドルール gitea
resource "aws_vpc_security_group_ingress_rule" "cmdb_ec2_sg_allow_gitea" {
security_group_id = aws_security_group.cmdb_ec2_sg.id
cidr_ipv4 = "0.0.0.0/0"
from_port = 3000
to_port = 3000
ip_protocol = "tcp"
}
# EC2用インバウンドルール jenkins
resource "aws_vpc_security_group_ingress_rule" "cmdb_ec2_sg_allow_jenkins" {
security_group_id = aws_security_group.cmdb_ec2_sg.id
cidr_ipv4 = "0.0.0.0/0"
from_port = 3500
to_port = 3500
ip_protocol = "tcp"
}
# EC2用アウトバウンドルール any
resource "aws_vpc_security_group_egress_rule" "cmdb_ec2_sg_allow_all" {
security_group_id = aws_security_group.cmdb_ec2_sg.id
cidr_ipv4 = "0.0.0.0/0"
ip_protocol = "-1"
}
# RDS用インバウンドルール mysql
resource "aws_vpc_security_group_ingress_rule" "cmdb_rds_sg_allow_http" {
security_group_id = aws_security_group.cmdb_rds_sg.id
cidr_ipv4 = "0.0.0.0/0"
from_port = 3306
to_port = 3306
ip_protocol = "tcp"
}
# RDS用アウトバウンドルール any
resource "aws_vpc_security_group_egress_rule" "cmdb_rds_sg_allow_all" {
security_group_id = aws_security_group.cmdb_rds_sg.id
cidr_ipv4 = "0.0.0.0/0"
ip_protocol = "-1"
}

70
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,70 @@
pipeline {
agent any
parameters {
booleanParam(name: 'RUN_DEPLOY', defaultValue: true, description: 'true: run deploy / false: run destory')
}
environment {
AWS_ACCESS_KEY_ID = credentials('aws-access-key-id') // JenkinsのCredentialで設定したキー
AWS_SECRET_ACCESS_KEY = credentials('aws-secret-access-key') // 同じくCredentialで設定したシークレットキー
}
options {
skipDefaultCheckout(true)
}
stages{
stage("checkout") {
when {
expression { return params.RUN_DEPLOY }
}
steps {
// Iacコードを取得
checkout scm
}
}
stage("terraform init") {
when {
expression { return params.RUN_DEPLOY }
}
steps {
// 初期化
dir('CMDB'){
sh "terraform init"
}
}
}
stage("terraform plan") {
when {
expression { return params.RUN_DEPLOY }
}
steps {
// 実行計画
dir('CMDB'){
sh "terraform plan -out=plan.out"
}
}
}
stage("terraform apply") {
when {
expression { return params.RUN_DEPLOY }
}
steps {
// 実行
dir('CMDB'){
sh "terraform apply plan.out"
}
}
}
stage("terraform destroy") {
when {
expression { return !params.RUN_DEPLOY }
}
steps {
dir('CMDB') {
sh "terraform destroy -auto-approve"
}
}
}
}
}

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# CMDB data
構成管理サーバーの環境構築のデータを格納しています

View File

@ -0,0 +1,47 @@
services:
gitea_app:
container_name: gitea_app
image: gitea/gitea:1.21.11
ports:
- "3000:3000"
environment:
DB_TYPE: postgres
DB_HOST: gitea_db:5432
DB_NAME: gitea
DB_USER: gitea
DB_PASSWD: gitea
USER_UID: 1000
USER_GID: 1000
TZ: Asia/Tokyo
volumes:
- ./data:/data
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- cmdb_net
gitea_db:
container_name: gitea_db
image: postgres:16.2-bullseye
environment:
POSTGRES_USER: gitea
POSTGRES_PASSWORD: gitea
POSTGRES_DB: gitea
TZ: Asia/Tokyo
volumes:
- ./db:/var/lib/postgresql/data
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- cmdb_net
networks:
cmdb_net:
external: true

29
docker/jenkins/.ssh_key Normal file
View File

@ -0,0 +1,29 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdz
c2gtcnNhAAAAAwEAAQAAAQEAmWl8Vr19yjtWrIM5G1h1mPX3yJ8OYH0UstgVEEY4
g6uxqZvE3jm37NEve+zJZhs2QaNtA4LtXJkmgNUNEPyd6bsJAwr1dQ9Aessot3Tg
dfgjzxiEBCQeWlHp5tdmoqaOHGV7Hu8IVl6BUUOmhUkGaOkMBxAlnaG+/EA1u50h
r/kuAn+jl/WekKUhXDpcOFq9pBFgNrpHOH8TUQm1t5RxCxLvCwX9kizdWIEeNdr8
1G3azICO7jGJqw3IEISSYk8pIj6zqsBOAJT8zKP2xCOKH+a4S0d0jxIJ/TPDvy4l
wDFL9PtZ8QwciYyjnSVHj8dNwvCPU7Q6IAavmfbJvatkdQAAA7imsP9sprD/bAAA
AAdzc2gtcnNhAAABAQCZaXxWvX3KO1asgzkbWHWY9ffInw5gfRSy2BUQRjiDq7Gp
m8TeObfs0S977MlmGzZBo20Dgu1cmSaA1Q0Q/J3puwkDCvV1D0B6yyi3dOB1+CPP
GIQEJB5aUenm12aipo4cZXse7whWXoFRQ6aFSQZo6QwHECWdob78QDW7nSGv+S4C
f6OX9Z6QpSFcOlw4Wr2kEWA2ukc4fxNRCbW3lHELEu8LBf2SLN1YgR412vzUbdrM
gI7uMYmrDcgQhJJiTykiPrOqwE4AlPzMo/bEI4of5rhLR3SPEgn9M8O/LiXAMUv0
+1nxDByJjKOdJUePx03C8I9TtDogBq+Z9sm9q2R1AAAAAwEAAQAAAQATQq8dpMS6
MyD6n673w+9fuOHXCkEf1BRZL8/VLzvBLDkt9iSNUenJjanMgTn328rACuiQ3Es4
qPGwkw8E5vJceeLzwth2TefmgsMl5UKZDQJR6d4JNw+of0hCdyCnowmMfyEqDRCa
51qM/VVWvohTe47LBDf0xm3X9afJWjz0fr6F7On4jhwNKEG2WvgTcHYRU+bD7/es
9zroI35/+Crdwz73Yl0uRslcPgcHZuC/UMQT09fr8ch/oxpgc+lkdNhf6LLdjQWB
m7rryXBO8atY7yaCkamy9k1QWMGbrb26AUULbYF/zb9s0/DeaPcmPdNYgSye6Rmz
7dVT7OgEaeixAAAAgD3Ie0lzBM0z9MwG59p5OZvfAUMexcSnn6aBg6ICe3lk8Qkk
KYR5TuKN7UcXbPKAHVsxq7j/sw31zK65ZFQhl6HzuguekPS8F0h6BMtVVPyoQrhh
9gk2gANuDfBhDCEdmjzQ8ztLjyTr6o2HMSJsierCt+AtKS01m1RFxKeXo8fdAAAA
gQDKoeXFgy8ThgCFtlIG4OJ9E/w4sNqY58WjpIq5YQm8KynbNmtEeSxzD7TMHhi0
Sgl+8GZA8aTob6/MPurukuawpHzDIagc/gWRD8ch9/KOfQCN0gYxsfU1XLLS2vsE
emXh+Ikm47LibybvhU/YsGHIB1NruaLELurfbl9xKml6owAAAIEAwdD/7BlA3JTG
vkoKO8D9PuOnYkUSt/5e1p28YihJZ6dX0WpHsfvhcAoXww0+2zPZnM5Kecz0iMt/
BokY5eIhga1jxEjhVkOcWPXZ12Yz5gZiQ0+OyYCk2WXyQcW6nZvyhZfPAziugFbG
2Ts+67lImZKnD3AS72BCep3FBaX9bgcAAAAAAQID
-----END OPENSSH PRIVATE KEY-----

21
docker/jenkins/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM jenkins/jenkins:2.489-jdk17
USER root
RUN apt-get update && \
apt-get install -y openssh-server sshpass openssl curl wget gpg ansible awscli
# terraform インストール
RUN wget https://releases.hashicorp.com/terraform/1.9.5/terraform_1.9.5_linux_amd64.zip && \
unzip terraform_1.9.5_linux_amd64.zip && \
mv terraform /usr/local/bin/ && \
terraform -install-autocomplete
# tool-version
RUN ansible --version && \
terraform --version
USER jenkins
ENV JAVA_OPTS="-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Dfile.encoding=UTF-8 -Duser.timezone=Asia/Tokyo"
COPY --chown=jenkins:jenkins plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli -f /usr/share/jenkins/ref/plugins.txt

View File

@ -0,0 +1,24 @@
services:
jenkins_app:
container_name: jenkins_app
build: .
image: jenkins/iac
ports:
- "3500:8080"
volumes:
- ./jenkins_home:/var/jenkins_home
- ./hosts:/etc/hosts
environment:
TZ: Asia/Tokyo
JENKINS_OPTS: --sessionTimeout=1440
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- cmdb_net
networks:
cmdb_net:
external: true

10
docker/jenkins/hosts Normal file
View File

@ -0,0 +1,10 @@
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.10.5 0df513804375
10.1.5.19 aws-handson-gitea.com
10.1.5.19 aws-handson-jenkins.com

View File

@ -0,0 +1,3 @@
terraform:1.0.10
pipeline-aws:1.45
ansible:403.v8d0ca_dcb_b_502

6
docker/network.txt Normal file
View File

@ -0,0 +1,6 @@
docker network create \
--subnet 192.168.10.0/24 \
--gateway 192.168.10.1 \
-o 'com.docker.network.bridge.name=cmdb_net' \
cmdb_net

View File

@ -0,0 +1,26 @@
server {
listen 80;
server_name ec2-35-78-220-30.ap-northeast-1.compute.amazonaws.com
root /var/www/html;
# タイムアウトの設定
proxy_connect_timeout 60;
proxy_read_timeout 90;
proxy_send_timeout 60;
# バッファサイズの設定
proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 100 8k;
# バックエンド転送
location / {
proxy_pass http://gitea_app:3000;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

View File

@ -0,0 +1,28 @@
server {
listen 80;
server_name aws-handson-gitea.com;
root /var/www/html;
# タイムアウトの設定
proxy_connect_timeout 60;
proxy_read_timeout 90;
proxy_send_timeout 60;
# バッファサイズの設定
proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 100 8k;
client_max_body_size 100M;
# バックエンド転送
location / {
proxy_pass http://gitea_app:3000;
proxy_redirect off;
proxy_cookie_domain localhost devops-tec-jenkins.wb.local;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

View File

@ -0,0 +1,26 @@
server {
listen 80;
server_name 35.78.220.30
root /var/www/html;
# タイムアウトの設定
proxy_connect_timeout 60;
proxy_read_timeout 90;
proxy_send_timeout 60;
# バッファサイズの設定
proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 100 8k;
# バックエンド転送
location / {
proxy_pass http://gitea_app:3000;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

View File

@ -0,0 +1,26 @@
server {
listen 80;
server_name aws-handson-jenkins.com;
root /var/www/html;
# タイムアウトの設定
proxy_connect_timeout 60;
proxy_read_timeout 90;
proxy_send_timeout 60;
# バッファサイズの設定
proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 100 8k;
# バックエンド転送
location / {
proxy_pass http://jenkins_app:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

View File

@ -0,0 +1,43 @@
user nginx;
worker_processes auto;
#error_log /var/log/nginx/error.log notice;
error_log /dev/stderr warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
client_max_body_size 1048576; # default 1m
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/nginx/access.log main;
log_format addHeaderlog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for" "$request_body" "$http_Authorization" "$http_x_my_header1" "$http_x_my_header2"'
'"$http_my_header1" "$http_my_header2" '
'"$http_user_agent" cookie[$http_cookie]';
access_log /dev/stdout addHeaderlog;
#sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
server_names_hash_bucket_size 128;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}

View File

@ -0,0 +1,21 @@
services:
reverse-proxy:
container_name: reverse-proxy
image: nginx:1.25.3-alpine3.18
ports:
- "80:80"
volumes:
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./conf/conf.d:/etc/nginx/conf.d
networks:
- cmdb_net
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
###command: [nginx-debug, '-g', 'daemon off;']
networks:
cmdb_net:
external: true

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA5DF6KE+ge31ihaknIv2VriHUSq9IJ9Xl5dJwHTrB+nOhInJE
dYaiFJyvUWurspBopZZBsyOLVPr/J0BO6WIT8bPGtE0ia2DVdP1g+Jisq9pPo99b
UbH5YjxE2g37cxEG/lmUjarjnrwisPRklxYTwcsxPNquhG0jqYkUDjqCrX+VfFXh
WaIANtVxaqBT/MVIpOf71N0OH/9HHI6vhge7YWSDP0znI86t7L/KNKS3yZHdxcPB
M/wh2iniBNledT5HA2KlA2QGxKPC3KoH6/vwIXetkY7CQqtnYly8ggnfjBkHQLWq
1IeyaW23brcRqzya+CH2JRtm22oZOJAZNgnlsQIDAQABAoIBAC/JHKesZRL3ItaS
oZt2Nw4MD4TER/vvkwEZnFjCoTRtWmT4QNXLp81hMmV+gqoWC5QBbyiwXNEi7qOt
l9jPrRWEbCv9qyOJV6n0FYZ5kk86nErYzyrAdlTYAiMXonxqKGjDIZS5IIlxJGKi
Cx6IhQKkJl9z++/HWxx5lDWWkx75n1fyVt8cZRJQZQusvFn40+eqQI6XGBLesK2e
IRvAEoDR8h2iUaryexebOorqz3rT/TJb+1zJEDfsd+0eAiglPtO8ZQatVHedDgZw
7cCzpGOenaFHdbIQOxmxrlBrMnO0qvgOm/hLF5o8zQmbkP/bGTzAOjOpANYDgx5+
bklquAECgYEA/xwwnCQMQ/AttnqdZQHngpGM+eNGaMwvNId1cxmbCloQH49TP3Kh
yEXMvk8y1PzSQXSlXISy86QwvW44hg9in+tAzCGZ+Z49UUO6gdGDYCb/goqcYtdF
MfvRha9UA+zviaW2wEDDRQJs5Se1oQwbnH1RsG6uuwl93XBMmU0FgpECgYEA5P1A
Olz+o5pYNC8G4zcOwo8/sd4L0H3+HiROAwKsviTeS6tqaNf4x1HrxNLqV7Bntw82
diFJryAGIOcZu7S8aJ/LbiB+20pV7GvQVOcJN9+NaOJKgsIQh70Bs2OVDIOlX9Iu
OJGyEwUtTgRKI8e3i1p6fGgYRhCqoHk3/pt5gSECgYBSVSe/DMdEmdw2+2WWtsGf
2xezgk0z/0nw2xLlvcrS0XRIqzoDzRw3hYdpmCfgo2O8KkhADreueDwettbZNVfw
Ir2749BMxmwlsQUdZp/OxWdLGy8Tm0RCuHHLgmVMCwjX1LqhW4Vp3TmFz4YH3t9+
ZteZaG9N/+c2M0sVYs03cQKBgQCpuSek2o6GNn0P2JdTS9itzj0YmYrKMshqEOCd
jJr6qBr3nQrWwNUM7yRAE1BMRFzrKuRj9FJH8gV417GUFebb6Sx/6Kf944ACJvsY
ItILTq/iQG+XsT1NToL3MmUkDGNDvWYy2ZJSVLD6tWU6Veot6JcGpKTxMaM2JAKj
vRr24QKBgG8g0A8ghAz9elMkYFXBdRe+1HLNxJPqUunAKaAbJeCqAgrC0XEIZKVc
UJoe0kUnFmVdvOQwFNZJShLSXPGH2GzASk5h2qLI7BjUoHAC7QROpxnMRC8b/b23
Q6txYN27X7D0y1UG+pvK0pDxbYB+CR+tLwruGLMFeFrv74qqVXTM
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,25 @@
---
- name: copy_file
hosts: localhost
become: true
vars_files: copy_info.yml
gather_facts: false
tasks:
- name: copy
copy:
src: /home/ec2-user/ansible/ansible
dest: "/home/{{ item }}/hands-on/"
group: hands-on
owner: "{{ item }}"
mode: 0644
with_items: "{{ user }}"
- name: copy
copy:
src: /home/ec2-user/ansible/.ssh
dest: "/home/{{ item }}/"
group: hands-on
owner: "{{ item }}"
mode: 0700
with_items: "{{ user }}"

View File

@ -0,0 +1,15 @@
user:
- user01
- user02
- user03
- user04
- user05
- user06
- user07
- user08
- user09
- user10
- user11
- user12
- user13

View File

@ -0,0 +1,197 @@
---
- name: create_ec2
hosts: localhost
gather_facts: false
tasks:
- name: Create EC2 instances 1
amazon.aws.ec2_instance:
name: ansible_ec2_web1
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.151"
device_index: 0
tags:
Name: ansible-ec2-web1
- name: Create EC2 instances 2
amazon.aws.ec2_instance:
name: ansible_ec2_web2
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.152"
device_index: 0
tags:
Name: ansible-ec2-web2
- name: Create EC2 instances 3
amazon.aws.ec2_instance:
name: ansible_ec2_web3
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.153"
device_index: 0
tags:
Name: ansible-ec2-web3
- name: Create EC2 instances 4
amazon.aws.ec2_instance:
name: ansible_ec2_web4
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.154"
device_index: 0
tags:
Name: ansible-ec2-web4
- name: Create EC2 instances 5
amazon.aws.ec2_instance:
name: ansible_ec2_web5
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.155"
device_index: 0
tags:
Name: ansible-ec2-web5
- name: Create EC2 instances 6
amazon.aws.ec2_instance:
name: ansible_ec2_web6
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.156"
device_index: 0
tags:
Name: ansible-ec2-web6
- name: Create EC2 instances 7
amazon.aws.ec2_instance:
name: ansible_ec2_web7
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.157"
device_index: 0
tags:
Name: ansible-ec2-web7
- name: Create EC2 instances 8
amazon.aws.ec2_instance:
name: ansible_ec2_web8
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.158"
device_index: 0
tags:
Name: ansible-ec2-web8
- name: Create EC2 instances 9
amazon.aws.ec2_instance:
name: ansible_ec2_web9
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.159"
device_index: 0
tags:
Name: ansible-ec2-web9
- name: Create EC2 instances 10
amazon.aws.ec2_instance:
name: ansible_ec2_web10
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.160"
device_index: 0
tags:
Name: ansible-ec2-web10
- name: Create EC2 instances 11
amazon.aws.ec2_instance:
name: ansible_ec2_web11
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.161"
device_index: 0
tags:
Name: ansible-ec2-web11
- name: Create EC2 instances 12
amazon.aws.ec2_instance:
name: ansible_ec2_web12
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.162"
device_index: 0
tags:
Name: ansible-ec2-web12

View File

@ -0,0 +1,197 @@
---
- name: create_ec2
hosts: localhost
gather_facts: false
tasks:
- name: Create EC2 instances 21
amazon.aws.ec2_instance:
name: ansible_ec2_web21
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.171"
device_index: 0
tags:
Name: ansible-ec2-web21
- name: Create EC2 instances 22
amazon.aws.ec2_instance:
name: ansible_ec2_web22
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.172"
device_index: 0
tags:
Name: ansible-ec2-web22
- name: Create EC2 instances 23
amazon.aws.ec2_instance:
name: ansible_ec2_web23
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.173"
device_index: 0
tags:
Name: ansible-ec2-web23
- name: Create EC2 instances 24
amazon.aws.ec2_instance:
name: ansible_ec2_web24
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.174"
device_index: 0
tags:
Name: ansible-ec2-web24
- name: Create EC2 instances 25
amazon.aws.ec2_instance:
name: ansible_ec2_web25
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.175"
device_index: 0
tags:
Name: ansible-ec2-web25
- name: Create EC2 instances 26
amazon.aws.ec2_instance:
name: ansible_ec2_web26
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.176"
device_index: 0
tags:
Name: ansible-ec2-web26
- name: Create EC2 instances 27
amazon.aws.ec2_instance:
name: ansible_ec2_web27
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.177"
device_index: 0
tags:
Name: ansible-ec2-web27
- name: Create EC2 instances 28
amazon.aws.ec2_instance:
name: ansible_ec2_web28
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.178"
device_index: 0
tags:
Name: ansible-ec2-web28
- name: Create EC2 instances 29
amazon.aws.ec2_instance:
name: ansible_ec2_web29
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.179"
device_index: 0
tags:
Name: ansible-ec2-web29
- name: Create EC2 instances 30
amazon.aws.ec2_instance:
name: ansible_ec2_web30
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.180"
device_index: 0
tags:
Name: ansible-ec2-web30
- name: Create EC2 instances 31
amazon.aws.ec2_instance:
name: ansible_ec2_web31
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.181"
device_index: 0
tags:
Name: ansible-ec2-web31
- name: Create EC2 instances 32
amazon.aws.ec2_instance:
name: ansible_ec2_web32
instance_type: t2.micro
image_id: ami-0525a3bbe44c34cbf
key_name: hands-on_ansible
region: ap-northeast-1
vpc_subnet_id: subnet-0689f38f21f538a55
security_group: jenkins-ec2-sg
network:
assign_public_ip: yes
private_ip_address: "10.1.5.182"
device_index: 0
tags:
Name: ansible-ec2-web32

View File

@ -0,0 +1,14 @@
---
- name: del_user
hosts: localhost
become: true
vars_files: localhost.yml
gather_facts: false
tasks:
- name: del_user
user:
name: "{{ item.name }}"
state: absent
remove: yes
with_items: "{{ user }}"

28535
ec2-user/ansible/get-pip.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
ansible_ssh_port: 22
ansible_user: ec2-user
ansible_ssh_private_key_file: ~/.ssh/hands-on_ansible.pem

5
ec2-user/ansible/hosts Normal file
View File

@ -0,0 +1,5 @@
[web]
10.1.5.162
[web2]
10.1.5.160

View File

@ -0,0 +1 @@
halo wld

View File

@ -0,0 +1,50 @@
user:
- name: ansible_user01
password: ansible01
group: hands-on_ansible
uid: 6001
- name: ansible_user02
password: ansible02
group: hands-on_ansible
uid: 6002
- name: ansible_user03
password: ansible03
group: hands-on_ansible
uid: 6003
- name: ansible_user04
password: ansible04
group: hands-on_ansible
uid: 6004
- name: ansible_user05
password: ansible05
group: hands-on_ansible
uid: 6005
- name: ansible_user06
password: ansible06
group: hands-on_ansible
uid: 6006
- name: ansible_user07
password: ansible07
group: hands-on_ansible
uid: 6007
- name: ansible_user08
password: ansible08
group: hands-on_ansible
uid: 6008
- name: ansible_user09
password: ansible09
group: hands-on_ansible
uid: 6009
- name: ansible_user10
password: ansible10
group: hands-on_ansible
uid: 6010

View File

@ -0,0 +1,15 @@
---
- name: add_user
hosts: localhost
become: true
vars_files: localhost.yml
gather_facts: false
tasks:
- name: add_user
user:
name: "{{ item.name }}"
password: " {{ item.password | password_hash('sha512') }}"
group: "{{ item.group }}"
uid: "{{ item.uid }}"
with_items: "{{ user }}"

View File

@ -0,0 +1,14 @@
---
- name: ping
hosts: web2
become: true
gather_facts: false
tasks:
- name: ping
ping:
register: ping_result
- name: debug
debug:
var: ping_result

View File

@ -0,0 +1,17 @@
---
- name: install httpd
hosts: web
become: true
gather_facts: false
tasks:
- name: install httpd
dnf:
name:
- httpd-2.4.58
- name: start apache
systemd:
name: httpd
state: restarted
enabled: yes

View File

@ -0,0 +1,20 @@
---
- name: install httpd
hosts: web
become: true
gather_facts: false
tasks:
- name: Copy web page
copy:
src: ./index.html
dest: /var/www/html/
owner: apache
group: apache
mode: '0755'
- name: restart apache
systemd:
name: httpd
state: restarted
enabled: yes

View File

@ -0,0 +1,3 @@
[default]
region = ap-northeast-1
output = json

View File

@ -0,0 +1,3 @@
[default]
aws_access_key_id = AKIARMLXVAFFKKUBZBJ6
aws_secret_access_key = 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

View File

@ -0,0 +1,24 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.81.0"
hashes = [
"h1:Z3G9/bESudmrRsgGrLYQbVfNOQcSYGO3uqTtMBeIxhY=",
"zh:05534adf6f02d6ec26dbeb37a4d2b6edb63f12dc9ab5cc05ab89329fcd793194",
"zh:1d224056866abc4c8f893d55bc6493b73688126fbeaf017ecfbcf5d2f16649c4",
"zh:486d28a0a4af2ea23964a8e9087d66e8d794e3438976633b8554684a9237499d",
"zh:4bc17c2e93034099b64eb94eaea31b48888b6abdf170e26cf0f6ea734926084c",
"zh:5c48c8e82fa8c410499eaa5980c0ebcf6a42360742dfd695393eb9b0bffd4232",
"zh:60c387caa94d67e0b768f5874abbd103638c4c9b14073b6cd121018efdfc77bc",
"zh:72ddd5e5e07aac1c1c54659df238e6490aac3abbd2e4f13ccf7a9d877c2e2d0f",
"zh:8b03d7c4e23a51c9d323f24784d6bfd044f03e6e512df8d458abc97c943a3d3e",
"zh:93b6a3c3299fc67d349f8ab80a9b6b65e0e9f3a7e7ea3da0cd87e3ca3b48137b",
"zh:9982fc3885797ee97aa45ac7eba0fe6870220748bfa3091141ff513dd7583809",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:b7d60f8527dbffe11c83a05b63459d18fda921616242246a73cf3044b8732bcf",
"zh:be7a57524298df3c377cdd676e691500277a423ac50f7b33dd02b7d6f4e924fd",
"zh:c6ae0b1510804c705aab99659f228bdbafa663fa72ace50c811c0b9220c7dafb",
"zh:cdf524a269b4aeb5b1f081d91f54bae967ad50d9c392073a0db1602166a48dff",
]
}

View File

@ -0,0 +1,22 @@
##
provider "aws" {
region = "ap-northeast-1" #
}
# EC2インスタンスの作成(Web1)
resource "aws_instance" "iac_web1" {
ami = "ami-0f75d1a8c9141bd00" # AMIの指定 (AmazonLinux2023)
instance_type = "t3.micro" #
availability_zone = "ap-northeast-1a" #
tags = {
Name = "iac_web1" #
}
}
# EC2インスタンスの作成(Web2)
resource "aws_instance" "iac_web2" {
ami = "ami-0f75d1a8c9141bd00" # AMIの指定 (AmazonLinux2023)
instance_type = "t3.micro" #
availability_zone = "ap-northeast-1a" #
tags = {
Name = "iac_web2" #
}
}

View File

@ -0,0 +1,24 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.81.0"
hashes = [
"h1:Z3G9/bESudmrRsgGrLYQbVfNOQcSYGO3uqTtMBeIxhY=",
"zh:05534adf6f02d6ec26dbeb37a4d2b6edb63f12dc9ab5cc05ab89329fcd793194",
"zh:1d224056866abc4c8f893d55bc6493b73688126fbeaf017ecfbcf5d2f16649c4",
"zh:486d28a0a4af2ea23964a8e9087d66e8d794e3438976633b8554684a9237499d",
"zh:4bc17c2e93034099b64eb94eaea31b48888b6abdf170e26cf0f6ea734926084c",
"zh:5c48c8e82fa8c410499eaa5980c0ebcf6a42360742dfd695393eb9b0bffd4232",
"zh:60c387caa94d67e0b768f5874abbd103638c4c9b14073b6cd121018efdfc77bc",
"zh:72ddd5e5e07aac1c1c54659df238e6490aac3abbd2e4f13ccf7a9d877c2e2d0f",
"zh:8b03d7c4e23a51c9d323f24784d6bfd044f03e6e512df8d458abc97c943a3d3e",
"zh:93b6a3c3299fc67d349f8ab80a9b6b65e0e9f3a7e7ea3da0cd87e3ca3b48137b",
"zh:9982fc3885797ee97aa45ac7eba0fe6870220748bfa3091141ff513dd7583809",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:b7d60f8527dbffe11c83a05b63459d18fda921616242246a73cf3044b8732bcf",
"zh:be7a57524298df3c377cdd676e691500277a423ac50f7b33dd02b7d6f4e924fd",
"zh:c6ae0b1510804c705aab99659f228bdbafa663fa72ace50c811c0b9220c7dafb",
"zh:cdf524a269b4aeb5b1f081d91f54bae967ad50d9c392073a0db1602166a48dff",
]
}

175
ec2-user/demo/demo2/main.tf Normal file
View File

@ -0,0 +1,175 @@
provider "aws" {
region = "ap-northeast-1"
}
resource "aws_vpc" "demo_vpc_main" {
cidr_block = "10.9.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true
tags = {
Name = "demo_vpc_main"
}
}
resource "aws_subnet" "demo_subnet_public_1" {
vpc_id = aws_vpc.demo_vpc_main.id
cidr_block = "10.9.1.0/24"
map_public_ip_on_launch = true
availability_zone = "ap-northeast-1a"
tags = {
Name = "demo_subnet_public_1"
}
}
resource "aws_subnet" "demo_subnet_public_2" {
vpc_id = aws_vpc.demo_vpc_main.id
cidr_block = "10.9.2.0/24"
map_public_ip_on_launch = true
availability_zone = "ap-northeast-1c"
tags = {
Name = "demo_subnet_public_2"
}
}
resource "aws_internet_gateway" "demo_igw_main" {
vpc_id = aws_vpc.demo_vpc_main.id
tags = {
Name = "demo_igw_main"
}
}
resource "aws_route_table" "demo_route_table_main" {
vpc_id = aws_vpc.demo_vpc_main.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.demo_igw_main.id
}
tags = {
Name = "demo_route_table_main"
}
}
resource "aws_route_table_association" "demo_assoc_public_1" {
subnet_id = aws_subnet.demo_subnet_public_1.id
route_table_id = aws_route_table.demo_route_table_main.id
}
resource "aws_route_table_association" "demo_assoc_public_2" {
subnet_id = aws_subnet.demo_subnet_public_2.id
route_table_id = aws_route_table.demo_route_table_main.id
}
resource "aws_security_group" "demo_sg_web" {
vpc_id = aws_vpc.demo_vpc_main.id
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "demo_sg_web"
}
}
resource "aws_instance" "demo_web_1" {
ami = "ami-0f75d1a8c9141bd00"
instance_type = "t2.micro"
subnet_id = aws_subnet.demo_subnet_public_1.id
security_groups = [aws_security_group.demo_sg_web.id]
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y httpd
echo "<html><body><h1>Terraformで作成されたWebサーバ</h1></body></html>" > /var/www/html/index.html
systemctl enable httpd
systemctl start httpd
EOF
tags = {
Name = "demo_web_1"
}
}
resource "aws_instance" "demo_web_2" {
ami = "ami-0f75d1a8c9141bd00"
instance_type = "t2.micro"
subnet_id = aws_subnet.demo_subnet_public_2.id
security_groups = [aws_security_group.demo_sg_web.id]
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y httpd
echo "<html><body><h1>Terraformで作成されたWebサーバ</h1></body></html>" > /var/www/html/index.html
systemctl enable httpd
systemctl start httpd
EOF
tags = {
Name = "demo_web_2"
}
}
resource "aws_lb" "demo_lb_main" {
name = "demo-lb-main"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.demo_sg_web.id]
subnets = [
aws_subnet.demo_subnet_public_1.id,
aws_subnet.demo_subnet_public_2.id
]
tags = {
Name = "demo_lb_main"
}
}
resource "aws_lb_target_group" "demo_tg_web" {
name = "demo-tg-web"
port = 80
protocol = "HTTP"
vpc_id = aws_vpc.demo_vpc_main.id
tags = {
Name = "demo_tg_web"
}
}
resource "aws_lb_target_group_attachment" "demo_attach_web_1" {
target_group_arn = aws_lb_target_group.demo_tg_web.arn
target_id = aws_instance.demo_web_1.id
port = 80
}
resource "aws_lb_target_group_attachment" "demo_attach_web_2" {
target_group_arn = aws_lb_target_group.demo_tg_web.arn
target_id = aws_instance.demo_web_2.id
port = 80
}
resource "aws_lb_listener" "demo_listener_http" {
load_balancer_arn = aws_lb.demo_lb_main.arn
port = 80
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.demo_tg_web.arn
}
}

View File

@ -0,0 +1,175 @@
provider "aws" {
region = "ap-northeast-1"
}
resource "aws_vpc" "demo_vpc_main" {
cidr_block = "10.9.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true
tags = {
Name = "demo_vpc_main"
}
}
resource "aws_subnet" "demo_subnet_public_1" {
vpc_id = aws_vpc.demo_vpc_main.id
cidr_block = "10.9.1.0/24"
map_public_ip_on_launch = true
availability_zone = "ap-northeast-1a"
tags = {
Name = "demo_subnet_public_1"
}
}
resource "aws_subnet" "demo_subnet_public_2" {
vpc_id = aws_vpc.demo_vpc_main.id
cidr_block = "10.9.2.0/24"
map_public_ip_on_launch = true
availability_zone = "ap-northeast-1c"
tags = {
Name = "demo_subnet_public_2"
}
}
resource "aws_internet_gateway" "demo_igw_main" {
vpc_id = aws_vpc.demo_vpc_main.id
tags = {
Name = "demo_igw_main"
}
}
resource "aws_route_table" "demo_route_table_main" {
vpc_id = aws_vpc.demo_vpc_main.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.demo_igw_main.id
}
tags = {
Name = "demo_route_table_main"
}
}
resource "aws_route_table_association" "demo_assoc_public_1" {
subnet_id = aws_subnet.demo_subnet_public_1.id
route_table_id = aws_route_table.demo_route_table_main.id
}
resource "aws_route_table_association" "demo_assoc_public_2" {
subnet_id = aws_subnet.demo_subnet_public_2.id
route_table_id = aws_route_table.demo_route_table_main.id
}
resource "aws_security_group" "demo_sg_web" {
vpc_id = aws_vpc.demo_vpc_main.id
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "demo_sg_web"
}
}
resource "aws_instance" "demo_web_1" {
ami = "ami-0f75d1a8c9141bd00"
instance_type = "t2.micro"
subnet_id = aws_subnet.demo_subnet_public_1.id
security_groups = [aws_security_group.demo_sg_web.id]
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y httpd
echo "<html><body><h1>Terraformで作成されたWebサーバ</h1></body></html>" > /var/www/html/index.html
systemctl enable httpd
systemctl start httpd
EOF
tags = {
Name = "demo_web_1"
}
}
resource "aws_instance" "demo_web_2" {
ami = "ami-0f75d1a8c9141bd00"
instance_type = "t2.micro"
subnet_id = aws_subnet.demo_subnet_public_2.id
security_groups = [aws_security_group.demo_sg_web.id]
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y httpd
echo "<html><body><h1>Terraformで作成されたWebサーバ</h1></body></html>" > /var/www/html/index.html
systemctl enable httpd
systemctl start httpd
EOF
tags = {
Name = "demo_web_2"
}
}
resource "aws_lb" "demo_lb_main" {
name = "demo-lb-main"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.demo_sg_web.id]
subnets = [
aws_subnet.demo_subnet_public_1.id,
aws_subnet.demo_subnet_public_2.id
]
tags = {
Name = "demo_lb_main"
}
}
resource "aws_lb_target_group" "demo_tg_web" {
name = "demo-tg-web"
port = 80
protocol = "HTTP"
vpc_id = aws_vpc.demo_vpc_main.id
tags = {
Name = "demo_tg_web"
}
}
resource "aws_lb_target_group_attachment" "demo_attach_web_1" {
target_group_arn = aws_lb_target_group.demo_tg_web.arn
target_id = aws_instance.demo_web_1.id
port = 80
}
resource "aws_lb_target_group_attachment" "demo_attach_web_2" {
target_group_arn = aws_lb_target_group.demo_tg_web.arn
target_id = aws_instance.demo_web_2.id
port = 80
}
resource "aws_lb_listener" "demo_listener_http" {
load_balancer_arn = aws_lb.demo_lb_main.arn
port = 80
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.demo_tg_web.arn
}
}

View File

@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.9.5",
"serial": 96,
"lineage": "aeeac7c3-7e1c-a1e0-095f-cc9727392647",
"outputs": {},
"resources": [],
"check_results": null
}

View File

@ -0,0 +1,900 @@
{
"version": 4,
"terraform_version": "1.9.5",
"serial": 80,
"lineage": "aeeac7c3-7e1c-a1e0-095f-cc9727392647",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_instance",
"name": "demo_web_1",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0f75d1a8c9141bd00",
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:instance/i-0f721588e39e30ae3",
"associate_public_ip_address": true,
"availability_zone": "ap-northeast-1a",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 1
}
],
"cpu_threads_per_core": 1,
"credit_specification": [
{
"cpu_credits": "standard"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enable_primary_ipv6": null,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-0f721588e39e30ae3",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t2.micro",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_protocol_ipv6": "disabled",
"http_put_response_hop_limit": 2,
"http_tokens": "required",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-048e53a411fcf30d1",
"private_dns": "ip-10-9-1-32.ap-northeast-1.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "ip-name"
}
],
"private_ip": "10.9.1.32",
"public_dns": "ec2-3-112-128-5.ap-northeast-1.compute.amazonaws.com",
"public_ip": "3.112.128.5",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": false,
"iops": 3000,
"kms_key_id": "",
"tags": {},
"tags_all": {},
"throughput": 125,
"volume_id": "vol-0ce30013c39bff0d7",
"volume_size": 8,
"volume_type": "gp3"
}
],
"secondary_private_ips": [],
"security_groups": [
"sg-0a917d86778b66c16"
],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-0f2e371f0010dc6e0",
"tags": {
"Name": "demo_web_1"
},
"tags_all": {
"Name": "demo_web_1"
},
"tenancy": "default",
"timeouts": null,
"user_data": "2bf70ae7606b4ed91abf0ff3cc8c27da75294d18",
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0a917d86778b66c16"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_security_group.demo_sg_web",
"aws_subnet.demo_subnet_public_1",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_instance",
"name": "demo_web_2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0f75d1a8c9141bd00",
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:instance/i-0daee39cc079c10b4",
"associate_public_ip_address": true,
"availability_zone": "ap-northeast-1c",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 1
}
],
"cpu_threads_per_core": 1,
"credit_specification": [
{
"cpu_credits": "standard"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enable_primary_ipv6": null,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-0daee39cc079c10b4",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t2.micro",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_protocol_ipv6": "disabled",
"http_put_response_hop_limit": 2,
"http_tokens": "required",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-080e9ca7ffbc05df0",
"private_dns": "ip-10-9-2-187.ap-northeast-1.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "ip-name"
}
],
"private_ip": "10.9.2.187",
"public_dns": "ec2-35-78-123-5.ap-northeast-1.compute.amazonaws.com",
"public_ip": "35.78.123.5",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": false,
"iops": 3000,
"kms_key_id": "",
"tags": {},
"tags_all": {},
"throughput": 125,
"volume_id": "vol-03dbb321020216c18",
"volume_size": 8,
"volume_type": "gp3"
}
],
"secondary_private_ips": [],
"security_groups": [
"sg-0a917d86778b66c16"
],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-071b9667aa4e11b05",
"tags": {
"Name": "demo_web_2"
},
"tags_all": {
"Name": "demo_web_2"
},
"tenancy": "default",
"timeouts": null,
"user_data": "9a7decfa2292b8b72a0d1f90fd0801f9a6fca6ae",
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-0a917d86778b66c16"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_security_group.demo_sg_web",
"aws_subnet.demo_subnet_public_2",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_internet_gateway",
"name": "demo_igw_main",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:internet-gateway/igw-0cf0649ef4f106fe6",
"id": "igw-0cf0649ef4f106fe6",
"owner_id": "095277089098",
"tags": {
"Name": "demo_igw_main"
},
"tags_all": {
"Name": "demo_igw_main"
},
"timeouts": null,
"vpc_id": "vpc-0f107a79b360c1fb9"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19",
"dependencies": [
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_lb",
"name": "demo_lb_main",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"access_logs": [
{
"bucket": "",
"enabled": false,
"prefix": ""
}
],
"arn": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:loadbalancer/app/demo-lb-main/79f2bd855b359068",
"arn_suffix": "app/demo-lb-main/79f2bd855b359068",
"client_keep_alive": 3600,
"connection_logs": [
{
"bucket": "",
"enabled": false,
"prefix": ""
}
],
"customer_owned_ipv4_pool": "",
"desync_mitigation_mode": "defensive",
"dns_name": "demo-lb-main-267186099.ap-northeast-1.elb.amazonaws.com",
"dns_record_client_routing_policy": null,
"drop_invalid_header_fields": false,
"enable_cross_zone_load_balancing": true,
"enable_deletion_protection": false,
"enable_http2": true,
"enable_tls_version_and_cipher_suite_headers": false,
"enable_waf_fail_open": false,
"enable_xff_client_port": false,
"enable_zonal_shift": false,
"enforce_security_group_inbound_rules_on_private_link_traffic": "",
"id": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:loadbalancer/app/demo-lb-main/79f2bd855b359068",
"idle_timeout": 60,
"internal": false,
"ip_address_type": "ipv4",
"load_balancer_type": "application",
"name": "demo-lb-main",
"name_prefix": "",
"preserve_host_header": false,
"security_groups": [
"sg-0a917d86778b66c16"
],
"subnet_mapping": [
{
"allocation_id": "",
"ipv6_address": "",
"outpost_id": "",
"private_ipv4_address": "",
"subnet_id": "subnet-071b9667aa4e11b05"
},
{
"allocation_id": "",
"ipv6_address": "",
"outpost_id": "",
"private_ipv4_address": "",
"subnet_id": "subnet-0f2e371f0010dc6e0"
}
],
"subnets": [
"subnet-071b9667aa4e11b05",
"subnet-0f2e371f0010dc6e0"
],
"tags": {
"Name": "demo_lb_main"
},
"tags_all": {
"Name": "demo_lb_main"
},
"timeouts": null,
"vpc_id": "vpc-0f107a79b360c1fb9",
"xff_header_processing_mode": "append",
"zone_id": "Z14GRHDCWA56QT"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH19",
"dependencies": [
"aws_security_group.demo_sg_web",
"aws_subnet.demo_subnet_public_1",
"aws_subnet.demo_subnet_public_2",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_lb_listener",
"name": "demo_listener_http",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"alpn_policy": null,
"arn": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:listener/app/demo-lb-main/79f2bd855b359068/8cacb3572903169c",
"certificate_arn": null,
"default_action": [
{
"authenticate_cognito": [],
"authenticate_oidc": [],
"fixed_response": [],
"forward": [],
"order": 1,
"redirect": [],
"target_group_arn": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:targetgroup/demo-tg-web/7b563928eb416771",
"type": "forward"
}
],
"id": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:listener/app/demo-lb-main/79f2bd855b359068/8cacb3572903169c",
"load_balancer_arn": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:loadbalancer/app/demo-lb-main/79f2bd855b359068",
"mutual_authentication": [],
"port": 80,
"protocol": "HTTP",
"ssl_policy": "",
"tags": null,
"tags_all": {},
"tcp_idle_timeout_seconds": null,
"timeouts": null
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=",
"dependencies": [
"aws_lb.demo_lb_main",
"aws_lb_target_group.demo_tg_web",
"aws_security_group.demo_sg_web",
"aws_subnet.demo_subnet_public_1",
"aws_subnet.demo_subnet_public_2",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_lb_target_group",
"name": "demo_tg_web",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:targetgroup/demo-tg-web/7b563928eb416771",
"arn_suffix": "targetgroup/demo-tg-web/7b563928eb416771",
"connection_termination": null,
"deregistration_delay": "300",
"health_check": [
{
"enabled": true,
"healthy_threshold": 5,
"interval": 30,
"matcher": "200",
"path": "/",
"port": "traffic-port",
"protocol": "HTTP",
"timeout": 5,
"unhealthy_threshold": 2
}
],
"id": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:targetgroup/demo-tg-web/7b563928eb416771",
"ip_address_type": "ipv4",
"lambda_multi_value_headers_enabled": false,
"load_balancer_arns": [],
"load_balancing_algorithm_type": "round_robin",
"load_balancing_anomaly_mitigation": "off",
"load_balancing_cross_zone_enabled": "use_load_balancer_configuration",
"name": "demo-tg-web",
"name_prefix": "",
"port": 80,
"preserve_client_ip": null,
"protocol": "HTTP",
"protocol_version": "HTTP1",
"proxy_protocol_v2": false,
"slow_start": 0,
"stickiness": [
{
"cookie_duration": 86400,
"cookie_name": "",
"enabled": false,
"type": "lb_cookie"
}
],
"tags": {
"Name": "demo_tg_web"
},
"tags_all": {
"Name": "demo_tg_web"
},
"target_failover": [
{
"on_deregistration": null,
"on_unhealthy": null
}
],
"target_group_health": [
{
"dns_failover": [
{
"minimum_healthy_targets_count": "1",
"minimum_healthy_targets_percentage": "off"
}
],
"unhealthy_state_routing": [
{
"minimum_healthy_targets_count": 1,
"minimum_healthy_targets_percentage": "off"
}
]
}
],
"target_health_state": [
{
"enable_unhealthy_connection_termination": null,
"unhealthy_draining_interval": null
}
],
"target_type": "instance",
"vpc_id": "vpc-0f107a79b360c1fb9"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_lb_target_group_attachment",
"name": "demo_attach_web_1",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"availability_zone": null,
"id": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:targetgroup/demo-tg-web/7b563928eb416771-20241217065617251800000006",
"port": 80,
"target_group_arn": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:targetgroup/demo-tg-web/7b563928eb416771",
"target_id": "i-0f721588e39e30ae3"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_instance.demo_web_1",
"aws_lb_target_group.demo_tg_web",
"aws_security_group.demo_sg_web",
"aws_subnet.demo_subnet_public_1",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_lb_target_group_attachment",
"name": "demo_attach_web_2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"availability_zone": null,
"id": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:targetgroup/demo-tg-web/7b563928eb416771-20241217065617185700000005",
"port": 80,
"target_group_arn": "arn:aws:elasticloadbalancing:ap-northeast-1:095277089098:targetgroup/demo-tg-web/7b563928eb416771",
"target_id": "i-0daee39cc079c10b4"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"aws_instance.demo_web_2",
"aws_lb_target_group.demo_tg_web",
"aws_security_group.demo_sg_web",
"aws_subnet.demo_subnet_public_2",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_route_table",
"name": "demo_route_table_main",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:route-table/rtb-0fb42cb820278a19c",
"id": "rtb-0fb42cb820278a19c",
"owner_id": "095277089098",
"propagating_vgws": [],
"route": [
{
"carrier_gateway_id": "",
"cidr_block": "0.0.0.0/0",
"core_network_arn": "",
"destination_prefix_list_id": "",
"egress_only_gateway_id": "",
"gateway_id": "igw-0cf0649ef4f106fe6",
"ipv6_cidr_block": "",
"local_gateway_id": "",
"nat_gateway_id": "",
"network_interface_id": "",
"transit_gateway_id": "",
"vpc_endpoint_id": "",
"vpc_peering_connection_id": ""
}
],
"tags": {
"Name": "demo_route_table_main"
},
"tags_all": {
"Name": "demo_route_table_main"
},
"timeouts": null,
"vpc_id": "vpc-0f107a79b360c1fb9"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19",
"dependencies": [
"aws_internet_gateway.demo_igw_main",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_route_table_association",
"name": "demo_assoc_public_1",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"gateway_id": "",
"id": "rtbassoc-0478a366df34ff2cb",
"route_table_id": "rtb-0fb42cb820278a19c",
"subnet_id": "subnet-0f2e371f0010dc6e0",
"timeouts": null
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19",
"dependencies": [
"aws_internet_gateway.demo_igw_main",
"aws_route_table.demo_route_table_main",
"aws_subnet.demo_subnet_public_1",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_route_table_association",
"name": "demo_assoc_public_2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"gateway_id": "",
"id": "rtbassoc-0f3962dc6e5b289b6",
"route_table_id": "rtb-0fb42cb820278a19c",
"subnet_id": "subnet-071b9667aa4e11b05",
"timeouts": null
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19",
"dependencies": [
"aws_internet_gateway.demo_igw_main",
"aws_route_table.demo_route_table_main",
"aws_subnet.demo_subnet_public_2",
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_security_group",
"name": "demo_sg_web",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:security-group/sg-0a917d86778b66c16",
"description": "Managed by Terraform",
"egress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 0,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "-1",
"security_groups": [],
"self": false,
"to_port": 0
}
],
"id": "sg-0a917d86778b66c16",
"ingress": [
{
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "",
"from_port": 80,
"ipv6_cidr_blocks": [],
"prefix_list_ids": [],
"protocol": "tcp",
"security_groups": [],
"self": false,
"to_port": 80
}
],
"name": "terraform-20241217065553471700000001",
"name_prefix": "terraform-",
"owner_id": "095277089098",
"revoke_rules_on_delete": false,
"tags": {
"Name": "demo_sg_web"
},
"tags_all": {
"Name": "demo_sg_web"
},
"timeouts": null,
"vpc_id": "vpc-0f107a79b360c1fb9"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
"dependencies": [
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_subnet",
"name": "demo_subnet_public_1",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:subnet/subnet-0f2e371f0010dc6e0",
"assign_ipv6_address_on_creation": false,
"availability_zone": "ap-northeast-1a",
"availability_zone_id": "apne1-az4",
"cidr_block": "10.9.1.0/24",
"customer_owned_ipv4_pool": "",
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"id": "subnet-0f2e371f0010dc6e0",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": true,
"outpost_arn": "",
"owner_id": "095277089098",
"private_dns_hostname_type_on_launch": "ip-name",
"tags": {
"Name": "demo_subnet_public_1"
},
"tags_all": {
"Name": "demo_subnet_public_1"
},
"timeouts": null,
"vpc_id": "vpc-0f107a79b360c1fb9"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_subnet",
"name": "demo_subnet_public_2",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:subnet/subnet-071b9667aa4e11b05",
"assign_ipv6_address_on_creation": false,
"availability_zone": "ap-northeast-1c",
"availability_zone_id": "apne1-az1",
"cidr_block": "10.9.2.0/24",
"customer_owned_ipv4_pool": "",
"enable_dns64": false,
"enable_lni_at_device_index": 0,
"enable_resource_name_dns_a_record_on_launch": false,
"enable_resource_name_dns_aaaa_record_on_launch": false,
"id": "subnet-071b9667aa4e11b05",
"ipv6_cidr_block": "",
"ipv6_cidr_block_association_id": "",
"ipv6_native": false,
"map_customer_owned_ip_on_launch": false,
"map_public_ip_on_launch": true,
"outpost_arn": "",
"owner_id": "095277089098",
"private_dns_hostname_type_on_launch": "ip-name",
"tags": {
"Name": "demo_subnet_public_2"
},
"tags_all": {
"Name": "demo_subnet_public_2"
},
"timeouts": null,
"vpc_id": "vpc-0f107a79b360c1fb9"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
"dependencies": [
"aws_vpc.demo_vpc_main"
]
}
]
},
{
"mode": "managed",
"type": "aws_vpc",
"name": "demo_vpc_main",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:vpc/vpc-0f107a79b360c1fb9",
"assign_generated_ipv6_cidr_block": false,
"cidr_block": "10.9.0.0/16",
"default_network_acl_id": "acl-03b345abb56e12174",
"default_route_table_id": "rtb-031762f747a4f813e",
"default_security_group_id": "sg-042bf87cc7cbdf8ea",
"dhcp_options_id": "dopt-5f01e23a",
"enable_dns_hostnames": true,
"enable_dns_support": true,
"enable_network_address_usage_metrics": false,
"id": "vpc-0f107a79b360c1fb9",
"instance_tenancy": "default",
"ipv4_ipam_pool_id": null,
"ipv4_netmask_length": null,
"ipv6_association_id": "",
"ipv6_cidr_block": "",
"ipv6_cidr_block_network_border_group": "",
"ipv6_ipam_pool_id": "",
"ipv6_netmask_length": 0,
"main_route_table_id": "rtb-031762f747a4f813e",
"owner_id": "095277089098",
"tags": {
"Name": "demo_vpc_main"
},
"tags_all": {
"Name": "demo_vpc_main"
}
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ=="
}
]
}
],
"check_results": null
}

35
ec2-user/deploy/memo Normal file
View File

@ -0,0 +1,35 @@
cp -rp userXX user01
cp -rp userXX user02
・・・・
cd ../user02
grep -rl 'userXX' . | xargs sed -i "s/userXX/user02/g"
git init
git checkout -b main
git add .
git commit -m "first commit"
git remote add origin http://aws-handson-gitea.com/hands-on/deploy-user02.git
git push -u origin main
cd ../user01
git reset --mixed c8254d163d46145f6c6cf189cd74c1acb77f1d3b
git push -f origin main
cd ../user02
git reset --mixed 6ffe5ed7f70929a964acdc384ddfd72dc6a40809
git push -f origin main
cd ../user03
git reset --mixed 74186dd766725e65e7b8da2bef8a8d8aded16740
git push -f origin main
cd ../user04
git reset --mixed fae85a118324834cfcf79ca2e087a3fb8841fafe
git push -f origin main
cd ../user05
git reset --mixed 8c8dbf0f9fb601cc8279b7ada51d386065ae00c6
git push -f origin main

View File

@ -0,0 +1,66 @@
pipeline {
agent any
environment {
AWS_ACCESS_KEY_ID = credentials('aws-access-key-id') // JenkinsのCredentialで設定したキー
AWS_SECRET_ACCESS_KEY = credentials('aws-secret-access-key') // 同じくCredentialで設定したシークレットキー
PUBLIC_IP = '' //WebサーバーのパブリックIP
PRIVATE_IP = '' //WebサーバーのプライベートIP
}
options {
skipDefaultCheckout(true)
}
stages{
stage("checkout") {
steps {
// Iacコードを取得
checkout scm
}
}
stage("terraform init") {
steps {
// 初期化
dir('step1'){
sh "terraform init"
}
}
}
stage("terraform plan") {
steps {
// 実行計画
dir('step1'){
sh "terraform plan -out=plan.out"
}
}
}
stage("terraform apply") {
steps {
// 実行
dir('step1'){
sh "terraform apply plan.out"
}
}
}
stage('Get Terraform Output') {
steps {
// ファイル出力
script {
dir('step1'){
PUBLIC_IP = sh(returnStdout: true, script: 'terraform output -raw instance_public_ip').trim()
PRIVATE_IP = sh(returnStdout: true, script: 'terraform output -raw instance_private_ip').trim()
}
dir("${env.WORKSPACE}/step2"){
def data1 = "[web]\n" + PRIVATE_IP + "\n"
def var1 = "ansible_port=22\n"
def var2 = "ansible_user=ec2-user\n"
def var3 = "ansible_ssh_private_key_file=~/.ssh_key\n"
def data2 = "[web:vars]\n" + var1 + var2 + var3
def data = data1 + "\n" + data2
writeFile(file: 'host', text: data)
}
}
}
}
}
}

View File

@ -0,0 +1,28 @@
##
provider "aws" {
region = "ap-northeast-1" #
}
# EC2インスタンスの作成(Web1)
resource "aws_instance" "handson_web1" {
ami = "ami-0f75d1a8c9141bd00" # AMIの指定 (AmazonLinux2023)
instance_type = "t2.micro" #
availability_zone = "ap-northeast-1a" #
subnet_id = "subnet-05b27965d35bb735f" #
vpc_security_group_ids = [
"sg-0d92c039f14e9f825", #
]
key_name = "jenkins-keypair" #
tags = {
Name = "userXX_handson_web1" #
}
#
user_data = <<-EOF
#! /bin/bash
sudo yum update
sudo yum install -y httpd git
sudo chkconfig httpd on
sudo service httpd start
echo "<h1>hello world</h1>" | sudo tee /var/www/html/index.html
echo "10.1.5.19 aws-handson-gitea.com" | sudo tee -a /etc/hosts
EOF
}

View File

@ -0,0 +1,15 @@
# EC2のプライベートIPを出力
output "instance_private_ip" {
description = "The private IP address of the instance"
value = aws_instance.handson_web1.private_ip
}
# EC2のパブリックIPを出力
output "instance_public_ip" {
description = "The public IP address of the instance"
value = aws_instance.handson_web1.public_ip
}
# EC2のIdを出力
output "instance_ec2_id" {
description = "ec2 id of the instance"
value = aws_instance.handson_web1.id
}

View File

@ -0,0 +1,16 @@
Jenkinsi : http://aws-handson-jenkins.com/
リポジトリ : http://aws-handson-gitea.com/hands-on/deploy-userXX.git
@STEP1
■リモートリポジトリをクローンする [コンソール操作]
cd ~/hands-on/jenkins
git clone http://aws-handson-gitea.com/hands-on/deploy-userXX.git
cd deploy-userXX
cd step1
vi main.tf
instance_type = "t2.small"
git add .
git commit -m "change"
git push

View File

@ -0,0 +1,82 @@
pipeline {
agent any
environment {
ANSIBLE_HOST_KEY_CHECKING = false
PUBLIC_IP = '52.194.230.165' //WebサーバーのパブリックIP
}
options {
skipDefaultCheckout(true)
}
stages{
stage("checkout") {
steps {
// Iacコードを取得
checkout scm
}
}
stage('Syntax Check') {
steps {
script {
// Ansible Playbookの文法チェック
dir('step2'){
ansiblePlaybook(
playbook: 'playbook.yml',
inventory: 'host',
extras: '--syntax-check'
)
}
}
}
}
stage('Dry Run (Check Mode)') {
steps {
script {
// Ansible Playbookの仮実行 (チェックモード)
dir('step2'){
ansiblePlaybook(
playbook: 'playbook.yml',
inventory: 'host',
extras: '--check'
)
}
}
}
}
stage('Apply (Real Execution)') {
steps {
script {
// Ansible Playbookの本実行
dir('step2'){
ansiblePlaybook(
playbook: 'playbook.yml',
inventory: 'host'
)
}
}
}
}
stage('Check Web Application Status') {
steps {
script {
def status = '0'
try {
// Webサイトのステータスをチェックする
def url = "http://${PUBLIC_IP}/"
status = sh(script: "curl -o /dev/null -s -w '%{http_code}' ${url}", returnStdout: true).trim()
} catch (Exception e) {
// エラー発生時でもジョブを失敗させない
echo "Error while checking the website: ${e.getMessage()}"
}
if (status != '200') {
echo "Website is not accessible. Status code: ${status}"
} else {
echo "Website is running successfully. Status code: ${status}"
}
}
}
}
}
}

View File

@ -0,0 +1,7 @@
[web]
10.1.1.221
[web:vars]
ansible_port=22
ansible_user=ec2-user
ansible_ssh_private_key_file=~/.ssh_key

View File

@ -0,0 +1,30 @@
---
- name: Deploy updated web pages
hosts: web
become: yes
tasks:
- name: remove directory
file:
path: /var/www/html
state: absent
- name: Pull the latest changes from the repository
git:
repo: 'http://aws-handson-gitea.com:3000/hands-on/webpage.git'
dest: '/var/www/html'
version: 'HEAD'
when: ansible_check_mode == false
- name: Set correct permissions
file:
path: '/var/www/html'
state: directory
owner: apache
group: apache
mode: '0755'
- name: httpd restart
service:
name: httpd
state: restarted
enabled: yes

View File

@ -0,0 +1,14 @@
Jenkinsi : http://aws-handson-jenkins.com/
リポジトリ : http://aws-handson-gitea.com/hands-on/deploy-userXX.git
@STEP2
■STEP1で作成したサーバのIPアドレスを指定する[コンソール操作]
cd ../step2
vi host
vi Jenkinsfile
git add .
git commit -m "change"
git push

158
ec2-user/deploy/userXX/step3/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,158 @@
pipeline {
agent any
environment {
AWS_ACCESS_KEY_ID = credentials('aws-access-key-id') // JenkinsのCredentialで設定したキー
AWS_SECRET_ACCESS_KEY = credentials('aws-secret-access-key') // 同じくCredentialで設定したシークレットキー
PUBLIC_IP = '' //WebサーバーのパブリックIP
PRIVATE_IP = '' //WebサーバーのプライベートIP
EC2_ID = '' //WebサーバーのEC2インスタンスID
ANSIBLE_HOST_KEY_CHECKING = false
RECIPIENT_SUCCESS = 'keduka@cm.jip.co.jp' // 成功時の通知先
RECIPIENT_FAILURE = 'Jenkins_sendmail@zohomail.jp' // 失敗時の通知先
}
options {
skipDefaultCheckout(true)
}
stages{
stage("checkout") {
steps {
// Iacコードを取得
checkout scm
}
}
stage("terraform init") {
steps {
// 初期化
dir('step3/terraform'){
sh "terraform init"
}
}
}
stage("terraform plan") {
steps {
// 実行計画
dir('step3/terraform'){
sh "terraform plan -out=plan.out"
}
}
}
stage("terraform apply") {
steps {
// 実行
dir('step3/terraform'){
sh "terraform apply plan.out"
}
}
}
stage('Get Terraform Output') {
steps {
// ファイル出力
script {
dir('step3/terraform'){
PUBLIC_IP = sh(returnStdout: true, script: 'terraform output -raw instance_public_ip').trim()
PRIVATE_IP = sh(returnStdout: true, script: 'terraform output -raw instance_private_ip').trim()
EC2_ID = sh(returnStdout: true, script: 'terraform output -raw instance_ec2_id').trim()
}
dir("${env.WORKSPACE}/step3/ansible"){
def data1 = "[web]\n" + PRIVATE_IP + "\n"
def var1 = "ansible_port=22\n"
def var2 = "ansible_user=ec2-user\n"
def var3 = "ansible_ssh_private_key_file=~/.ssh_key\n"
def data2 = "[web:vars]\n" + var1 + var2 + var3
def data = data1 + "\n" + data2
writeFile(file: 'host', text: data)
}
}
}
}
stage('Initialize') {
steps {
script {
// インスタンスのステータスOKまで待機
sh("aws ec2 wait instance-status-ok --instance-ids ${EC2_ID}")
}
}
}
stage('Syntax Check') {
steps {
script {
// Ansible Playbookの文法チェック
dir('step3/ansible'){
ansiblePlaybook(
playbook: 'playbook.yml',
inventory: 'host',
extras: '--syntax-check'
)
}
}
}
}
stage('Dry Run (Check Mode)') {
steps {
script {
// Ansible Playbookの仮実行 (チェックモード)
dir('step3/ansible'){
ansiblePlaybook(
playbook: 'playbook.yml',
inventory: 'host',
extras: '--check'
)
}
}
}
}
stage('Apply (Real Execution)') {
steps {
script {
// Ansible Playbookの本実行
dir('step3/ansible'){
ansiblePlaybook(
playbook: 'playbook.yml',
inventory: 'host'
)
}
}
}
}
stage('Check Web Application Status') {
steps {
script {
def status = '0'
try {
// Webサイトのステータスをチェックする
def url = "http://${PUBLIC_IP}/"
status = sh(script: "curl -o /dev/null -s -w '%{http_code}' ${url}", returnStdout: true).trim()
} catch (Exception e) {
// エラー発生時でもジョブを失敗させない
echo "Error while checking the website: ${e.getMessage()}"
}
if (status != '200') {
echo "Website is not accessible. Status code: ${status}"
} else {
echo "Website is running successfully. Status code: ${status}"
}
}
}
}
}
post {
success {
// 正常終了時にメール通知
mail to: "${RECIPIENT_SUCCESS}",
from: 'jenkins_sendmail@zohomail.jp',
subject: "SUCCESS: Web Application Deployed Successfully: ${currentBuild.fullDisplayName}",
body: "The web application was deployed successfully and is accessible at http://${PUBLIC_IP}/"
}
failure {
// エラー発生時にエラーメール通知
mail to: "${RECIPIENT_FAILURE}",
from: 'jenkins_sendmail@zohomail.jp',
subject: "FAILURE: Web Application Deployment Failed: ${currentBuild.fullDisplayName}",
body: "The web application deployment failed. Please check the Jenkins job for more details.\n${env.BUILD_URL}"
}
}
}

View File

@ -0,0 +1,30 @@
---
- name: Deploy updated web pages
hosts: web
become: yes
tasks:
- name: remove directory
file:
path: /var/www/html
state: absent
- name: Pull the latest changes from the repository
git:
repo: 'http://aws-handson-gitea.com:3000/hands-on/webpage.git'
dest: '/var/www/html'
version: 'HEAD'
when: ansible_check_mode == false
- name: Set correct permissions
file:
path: '/var/www/html'
state: directory
owner: apache
group: apache
mode: '0755'
- name: httpd restart
service:
name: httpd
state: restarted
enabled: yes

View File

@ -0,0 +1,12 @@
Jenkinsi : http://aws-handson-jenkins.com/
リポジトリ : http://aws-handson-gitea.com/hands-on/deploy-userXX.git
@STEP3
■メール通知先を自身のメールアドレスに変更する[コンソール操作]
cd ../step3
vi Jenkinsfile
git add .
git commit -m "change"
git push

View File

@ -0,0 +1,28 @@
##
provider "aws" {
region = "ap-northeast-1" #
}
# EC2インスタンスの作成(Web1)
resource "aws_instance" "handson_web1" {
ami = "ami-0f75d1a8c9141bd00" # AMIの指定 (AmazonLinux2023)
instance_type = "t2.micro" #
availability_zone = "ap-northeast-1a" #
subnet_id = "subnet-05b27965d35bb735f" #
vpc_security_group_ids = [
"sg-0d92c039f14e9f825", #
]
key_name = "jenkins-keypair" #
tags = {
Name = "userXX_handson_web2" #
}
#
user_data = <<-EOF
#! /bin/bash
sudo yum update
sudo yum install -y httpd git
sudo chkconfig httpd on
sudo service httpd start
echo "<h1>hello world</h1>" | sudo tee /var/www/html/index.html
echo "10.1.5.19 aws-handson-gitea.com" | sudo tee -a /etc/hosts
EOF
}

View File

@ -0,0 +1,15 @@
# EC2のプライベートIPを出力
output "instance_private_ip" {
description = "The private IP address of the instance"
value = aws_instance.handson_web1.private_ip
}
# EC2のパブリックIPを出力
output "instance_public_ip" {
description = "The public IP address of the instance"
value = aws_instance.handson_web1.public_ip
}
# EC2のIdを出力
output "instance_ec2_id" {
description = "ec2 id of the instance"
value = aws_instance.handson_web1.id
}

View File

@ -0,0 +1,24 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.82.2"
hashes = [
"h1:RuPaHbllUB8a2TGTyc149wJfoh6zhIEjUvFYKR6iP2E=",
"zh:0262fc96012fb7e173e1b7beadd46dfc25b1dc7eaef95b90e936fc454724f1c8",
"zh:397413613d27f4f54d16efcbf4f0a43c059bd8d827fe34287522ae182a992f9b",
"zh:436c0c5d56e1da4f0a4c13129e12a0b519d12ab116aed52029b183f9806866f3",
"zh:4d942d173a2553d8d532a333a0482a090f4e82a2238acf135578f163b6e68470",
"zh:624aebc549bfbce06cc2ecfd8631932eb874ac7c10eb8466ce5b9a2fbdfdc724",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:9e632dee2dfdf01b371cca7854b1ec63ceefa75790e619b0642b34d5514c6733",
"zh:a07567acb115b60a3df8f6048d12735b9b3bcf85ec92a62f77852e13d5a3c096",
"zh:ab7002df1a1be6432ac0eb1b9f6f0dd3db90973cd5b1b0b33d2dae54553dfbd7",
"zh:bc1ff65e2016b018b3e84db7249b2cd0433cb5c81dc81f9f6158f2197d6b9fde",
"zh:bcad84b1d767f87af6e1ba3dc97fdb8f2ad5de9224f192f1412b09aba798c0a8",
"zh:cf917dceaa0f9d55d9ff181b5dcc4d1e10af21b6671811b315ae2a6eda866a2a",
"zh:d8e90ecfb3216f3cc13ccde5a16da64307abb6e22453aed2ac3067bbf689313b",
"zh:d9054e0e40705df729682ad34c20db8695d57f182c65963abd151c6aba1ab0d3",
"zh:ecf3a4f3c57eb7e89f71b8559e2a71e4cdf94eea0118ec4f2cb37e4f4d71a069",
]
}

13
ec2-user/hands-on/main.tf Normal file
View File

@ -0,0 +1,13 @@
##
provider "aws" {
region = var.region #
}
# EC2インスタンスの作成
resource "aws_instance" "hands_web1" {
ami = var.ami # AMIの指定 (AmazonLinux2023)
instance_type = var.instance_type #
availability_zone = var.availability_zone #
tags = {
Name = var.instance_name #
}
}

View File

@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.9.5",
"serial": 9,
"lineage": "a439b8f6-fc93-0962-779a-330374d69c57",
"outputs": {},
"resources": [],
"check_results": null
}

View File

@ -0,0 +1,144 @@
{
"version": 4,
"terraform_version": "1.9.5",
"serial": 7,
"lineage": "a439b8f6-fc93-0962-779a-330374d69c57",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "aws_instance",
"name": "hands_web1",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"ami": "ami-0f75d1a8c9141bd00",
"arn": "arn:aws:ec2:ap-northeast-1:095277089098:instance/i-0dd98f633fd5461e6",
"associate_public_ip_address": true,
"availability_zone": "ap-northeast-1a",
"capacity_reservation_specification": [
{
"capacity_reservation_preference": "open",
"capacity_reservation_target": []
}
],
"cpu_core_count": 1,
"cpu_options": [
{
"amd_sev_snp": "",
"core_count": 1,
"threads_per_core": 1
}
],
"cpu_threads_per_core": 1,
"credit_specification": [
{
"cpu_credits": "standard"
}
],
"disable_api_stop": false,
"disable_api_termination": false,
"ebs_block_device": [],
"ebs_optimized": false,
"enable_primary_ipv6": null,
"enclave_options": [
{
"enabled": false
}
],
"ephemeral_block_device": [],
"get_password_data": false,
"hibernation": false,
"host_id": "",
"host_resource_group_arn": null,
"iam_instance_profile": "",
"id": "i-0dd98f633fd5461e6",
"instance_initiated_shutdown_behavior": "stop",
"instance_lifecycle": "",
"instance_market_options": [],
"instance_state": "running",
"instance_type": "t2.small",
"ipv6_address_count": 0,
"ipv6_addresses": [],
"key_name": "",
"launch_template": [],
"maintenance_options": [
{
"auto_recovery": "default"
}
],
"metadata_options": [
{
"http_endpoint": "enabled",
"http_protocol_ipv6": "disabled",
"http_put_response_hop_limit": 2,
"http_tokens": "required",
"instance_metadata_tags": "disabled"
}
],
"monitoring": false,
"network_interface": [],
"outpost_arn": "",
"password_data": "",
"placement_group": "",
"placement_partition_number": 0,
"primary_network_interface_id": "eni-04623eb60f3d98d70",
"private_dns": "ip-172-31-28-119.ap-northeast-1.compute.internal",
"private_dns_name_options": [
{
"enable_resource_name_dns_a_record": false,
"enable_resource_name_dns_aaaa_record": false,
"hostname_type": "ip-name"
}
],
"private_ip": "172.31.28.119",
"public_dns": "ec2-54-178-34-13.ap-northeast-1.compute.amazonaws.com",
"public_ip": "54.178.34.13",
"root_block_device": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"encrypted": false,
"iops": 3000,
"kms_key_id": "",
"tags": {},
"tags_all": {},
"throughput": 125,
"volume_id": "vol-03b177acfbca431c2",
"volume_size": 8,
"volume_type": "gp3"
}
],
"secondary_private_ips": [],
"security_groups": [
"default"
],
"source_dest_check": true,
"spot_instance_request_id": "",
"subnet_id": "subnet-c91da0be",
"tags": {
"Name": "user01-web1"
},
"tags_all": {
"Name": "user01-web1"
},
"tenancy": "default",
"timeouts": null,
"user_data": null,
"user_data_base64": null,
"user_data_replace_on_change": false,
"volume_tags": null,
"vpc_security_group_ids": [
"sg-24c5aa41"
]
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9"
}
]
}
],
"check_results": null
}

View File

@ -0,0 +1,5 @@
#
instance_name = "user01-web1"
instance_type = "t2.small"
ami = "ami-0f75d1a8c9141bd00"
availability_zone = "ap-northeast-1a"

View File

@ -0,0 +1,16 @@
variable "region" {
type = string
default = "ap-northeast-1"
}
variable "availability_zone" {
type = string
}
variable "instance_name" {
type = string
}
variable "instance_type" {
type = string
}
variable "ami" {
type = string
}

27
ec2-user/key/rsa-key Normal file
View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAmWl8Vr19yjtWrIM5G1h1mPX3yJ8OYH0UstgVEEY4g6uxqZvE
3jm37NEve+zJZhs2QaNtA4LtXJkmgNUNEPyd6bsJAwr1dQ9Aessot3TgdfgjzxiE
BCQeWlHp5tdmoqaOHGV7Hu8IVl6BUUOmhUkGaOkMBxAlnaG+/EA1u50hr/kuAn+j
l/WekKUhXDpcOFq9pBFgNrpHOH8TUQm1t5RxCxLvCwX9kizdWIEeNdr81G3azICO
7jGJqw3IEISSYk8pIj6zqsBOAJT8zKP2xCOKH+a4S0d0jxIJ/TPDvy4lwDFL9PtZ
8QwciYyjnSVHj8dNwvCPU7Q6IAavmfbJvatkdQIDAQABAoIBABNCrx2kxLozIPqf
rvfD71+44dcKQR/UFFkvz9UvO8EsOS32JI1R6cmNqcyBOffbysAK6JDcSzio8bCT
DwTm8lx54vPC2HZN5+aCwyXlQpkNAlHp3gk3D6h/SEJ3IKejCYx/ISoNEJrnWoz9
VVa+iFN7jssEN/TGbdf1p8laPPR+voXs6fiOHA0oQbZa+BNwdhFT5sPv96z3Ougj
fn/4Kt3DPvdiXS5GyVw+Bwdm4L9QxBPT1+vxyH+jGmBz6WR02F/ost2NBYGbuuvJ
cE7xq1jvJoKRqbL2TVBYwZutvboBRQttgX/Nv2zT8N5o9yY901iBLJ7pGbPt1VPs
6ARp6LECgYEAyqHlxYMvE4YAhbZSBuDifRP8OLDamOfFo6SKuWEJvCsp2zZrRHks
cw+0zB4YtEoJfvBmQPGk6G+vzD7q7pLmsKR8wyGoHP4FkQ/HIffyjn0AjdIGMbH1
NVyy0tr7BHpl4fiJJuOy4m8m74VP2LBhyAdTa7mixC7q325fcSppeqMCgYEAwdD/
7BlA3JTGvkoKO8D9PuOnYkUSt/5e1p28YihJZ6dX0WpHsfvhcAoXww0+2zPZnM5K
ecz0iMt/BokY5eIhga1jxEjhVkOcWPXZ12Yz5gZiQ0+OyYCk2WXyQcW6nZvyhZfP
AziugFbG2Ts+67lImZKnD3AS72BCep3FBaX9bgcCgYEAsMczZPAApwC1/fFEeJnD
HinMVkz8OH+jbhODrxzYWGAzwPol9PPd8nfWXGk5VjhtNmBWZPwryVh+vyp43TAt
sBegfMAlIT3/70Ebkif1ZZfqXs/G9Z3ydd5saAYBDjQWJGEmjlYB3wfnqPjd4wZm
GBNEFOw78vmXkNuCyoCcyw8CgYBBUbWelVg1vvJIGV3fi4gN1N2JkevgFJtTyy89
CYTLqStAiYgGJPRyNQSTGPixGYVigme5KujS3Xo+8p9wgkh2ksAH2+QNlZWwqZK0
NF6TTF17f+mIYZGtLt15azEcgv02JtZ+qHCvEg/MEFqBSR19nF4vJr9K628cMeW/
pJSHqwKBgD3Ie0lzBM0z9MwG59p5OZvfAUMexcSnn6aBg6ICe3lk8QkkKYR5TuKN
7UcXbPKAHVsxq7j/sw31zK65ZFQhl6HzuguekPS8F0h6BMtVVPyoQrhh9gk2gANu
DfBhDCEdmjzQ8ztLjyTr6o2HMSJsierCt+AtKS01m1RFxKeXo8fd
-----END RSA PRIVATE KEY-----

29
ec2-user/key/ssh-key Normal file
View File

@ -0,0 +1,29 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdz
c2gtcnNhAAAAAwEAAQAAAQEAmWl8Vr19yjtWrIM5G1h1mPX3yJ8OYH0UstgVEEY4
g6uxqZvE3jm37NEve+zJZhs2QaNtA4LtXJkmgNUNEPyd6bsJAwr1dQ9Aessot3Tg
dfgjzxiEBCQeWlHp5tdmoqaOHGV7Hu8IVl6BUUOmhUkGaOkMBxAlnaG+/EA1u50h
r/kuAn+jl/WekKUhXDpcOFq9pBFgNrpHOH8TUQm1t5RxCxLvCwX9kizdWIEeNdr8
1G3azICO7jGJqw3IEISSYk8pIj6zqsBOAJT8zKP2xCOKH+a4S0d0jxIJ/TPDvy4l
wDFL9PtZ8QwciYyjnSVHj8dNwvCPU7Q6IAavmfbJvatkdQAAA7imsP9sprD/bAAA
AAdzc2gtcnNhAAABAQCZaXxWvX3KO1asgzkbWHWY9ffInw5gfRSy2BUQRjiDq7Gp
m8TeObfs0S977MlmGzZBo20Dgu1cmSaA1Q0Q/J3puwkDCvV1D0B6yyi3dOB1+CPP
GIQEJB5aUenm12aipo4cZXse7whWXoFRQ6aFSQZo6QwHECWdob78QDW7nSGv+S4C
f6OX9Z6QpSFcOlw4Wr2kEWA2ukc4fxNRCbW3lHELEu8LBf2SLN1YgR412vzUbdrM
gI7uMYmrDcgQhJJiTykiPrOqwE4AlPzMo/bEI4of5rhLR3SPEgn9M8O/LiXAMUv0
+1nxDByJjKOdJUePx03C8I9TtDogBq+Z9sm9q2R1AAAAAwEAAQAAAQATQq8dpMS6
MyD6n673w+9fuOHXCkEf1BRZL8/VLzvBLDkt9iSNUenJjanMgTn328rACuiQ3Es4
qPGwkw8E5vJceeLzwth2TefmgsMl5UKZDQJR6d4JNw+of0hCdyCnowmMfyEqDRCa
51qM/VVWvohTe47LBDf0xm3X9afJWjz0fr6F7On4jhwNKEG2WvgTcHYRU+bD7/es
9zroI35/+Crdwz73Yl0uRslcPgcHZuC/UMQT09fr8ch/oxpgc+lkdNhf6LLdjQWB
m7rryXBO8atY7yaCkamy9k1QWMGbrb26AUULbYF/zb9s0/DeaPcmPdNYgSye6Rmz
7dVT7OgEaeixAAAAgD3Ie0lzBM0z9MwG59p5OZvfAUMexcSnn6aBg6ICe3lk8Qkk
KYR5TuKN7UcXbPKAHVsxq7j/sw31zK65ZFQhl6HzuguekPS8F0h6BMtVVPyoQrhh
9gk2gANuDfBhDCEdmjzQ8ztLjyTr6o2HMSJsierCt+AtKS01m1RFxKeXo8fdAAAA
gQDKoeXFgy8ThgCFtlIG4OJ9E/w4sNqY58WjpIq5YQm8KynbNmtEeSxzD7TMHhi0
Sgl+8GZA8aTob6/MPurukuawpHzDIagc/gWRD8ch9/KOfQCN0gYxsfU1XLLS2vsE
emXh+Ikm47LibybvhU/YsGHIB1NruaLELurfbl9xKml6owAAAIEAwdD/7BlA3JTG
vkoKO8D9PuOnYkUSt/5e1p28YihJZ6dX0WpHsfvhcAoXww0+2zPZnM5Kecz0iMt/
BokY5eIhga1jxEjhVkOcWPXZ12Yz5gZiQ0+OyYCk2WXyQcW6nZvyhZfPAziugFbG
2Ts+67lImZKnD3AS72BCep3FBaX9bgcAAAAAAQID
-----END OPENSSH PRIVATE KEY-----

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.84.0"
hashes = [
"h1:dwpeFUdcxgXVAc0JSqO57xf0/r2qOBLPloombCQWFz8=",
"zh:078f77438aba6ec8bf9154b7d223e5c71c48d805d6cd3bcf9db0cc1e82668ac3",
"zh:1f6591ff96be00501e71b792ed3a5a14b21ff03afec9a1c4a3fd9300e6e5b674",
"zh:2ab694e022e81dd74485351c5836148a842ed71cf640664c9d871cb517b09602",
"zh:33c8ccb6e3dc496e828a7572dd981366c6271075c1189f249b9b5236361d7eff",
"zh:6f31068ebad1d627e421c72ccdaafe678c53600ca73714e977bf45ff43ae5d17",
"zh:7488623dccfb639347cae66f9001d39cf06b92e8081975235a1ac3a0ac3f44aa",
"zh:7f042b78b9690a8725c95b91a70fc8e264011b836605bcc342ac297b9ea3937d",
"zh:88b56ac6c7209dc0a775b79975a371918f3aed8f015c37d5899f31deff37c61a",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a1979ba840d704af0932f8de5f541cbb4caa9b6bbd25ed552a24e6772175ba07",
"zh:b058c0533dae580e69d1adbc1f69e6a80632374abfc10e8634d06187a108e87b",
"zh:c88610af9cf957f8dcf4382e0c9ca566ef10e3290f5de01d4d90b2d81b078aa8",
"zh:e9562c055a2247d0c287772b55abef468c79f8d66a74780fe1c5e5dae1a284a9",
"zh:f7a7c71d28441d925a25c08c4485c015b2d9f0338bc9707443e91ff8e161d3d9",
"zh:fee533e81976d0900aa6fa443dc54ef171cbd901847f28a6e8edb1d161fa6fde",
]
}

View File

@ -0,0 +1,375 @@
Copyright (c) 2017 HashiCorp, Inc.
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View File

@ -0,0 +1,6 @@
mysql -h ansible-rds.cikxgx5zabf3.ap-northeast-1.rds.amazonaws.com -u admin -p
# DB情報の設定
db_name = "mysql"
username = "admin"
password = "passw0rd!"

30
ec2-user/mysql/rds.tf Normal file
View File

@ -0,0 +1,30 @@
# ---------------------------
# RDS
# ---------------------------
# RDSインスタンスの作成
resource "aws_db_instance" "ansible_rds" {
identifier = "ansible-rds"
#
instance_class = "db.t3.micro"
allocated_storage = 20
# DBサブネットグループの指定
db_subnet_group_name = "jenkins-db-subnet-group"
#
vpc_security_group_ids = [
"sg-007ef3c5be8c5e086"
]
# DBエンジンの指定
engine = "mysql"
engine_version = "8.0.35"
# DB情報の設定
db_name = "mysql"
username = "admin"
password = "passw0rd!"
#
apply_immediately = true
# DB削除時にスナップショットを作成しない
skip_final_snapshot = true
# 0
backup_retention_period = "10"
}

View File

@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.9.5",
"serial": 1,
"lineage": "e4701827-11eb-8fc2-447d-cfb58d1ebb4f",
"outputs": {},
"resources": [],
"check_results": null
}

81
gitea/demo/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,81 @@
pipeline {
agent any
environment {
AWS_ACCESS_KEY_ID = credentials('aws-access-key-id') // JenkinsのCredentialで設定したキー
AWS_SECRET_ACCESS_KEY = credentials('aws-secret-access-key') // 同じくCredentialで設定したシークレットキー
}
options {
skipDefaultCheckout(true)
}
tools {
terraform "Terraform-1.9.5"
}
stages{
stage("checkout") {
when {
expression {
return stats.toBoolean()
}
}
steps {
// Iacコードを取得
checkout scm
}
}
stage("terraform init") {
when {
expression {
return stats.toBoolean()
}
}
steps {
// 初期化
dir('demo2'){
sh "terraform init -no-color"
}
}
}
stage("terraform plan") {
when {
expression {
return stats.toBoolean()
}
}
steps {
// 実行計画
dir('demo2'){
sh "terraform plan -no-color -out=plan.out"
}
}
}
stage("terraform apply") {
when {
expression {
return stats.toBoolean()
}
}
steps {
// 実行
dir('demo2'){
sh "terraform apply plan.out -no-color"
}
}
}
stage("terraform destroy") {
when {
expression {
return !stats.toBoolean()
}
}
steps {
// 実行
dir('demo2'){
sh "terraform destroy -auto-approve -no-color"
}
}
}
}
}

3
gitea/demo/README.md Normal file
View File

@ -0,0 +1,3 @@
# IaCセッション 自動化デモ
これは、Infrastructure as CodeIaCの化デモのコードです。

22
gitea/demo/demo1/main.tf Normal file
View File

@ -0,0 +1,22 @@
##
provider "aws" {
region = "ap-northeast-1" #
}
# EC2インスタンスの作成(Web1)
resource "aws_instance" "iac_web1" {
ami = "ami-0f75d1a8c9141bd00" # AMIの指定 (AmazonLinux2023)
instance_type = "t3.micro" #
availability_zone = "ap-northeast-1a" #
tags = {
Name = "iac_web1" #
}
}
# EC2インスタンスの作成(Web2)
resource "aws_instance" "iac_web2" {
ami = "ami-0f75d1a8c9141bd00" # AMIの指定 (AmazonLinux2023)
instance_type = "t3.micro" #
availability_zone = "ap-northeast-1a" #
tags = {
Name = "iac_web2" #
}
}

175
gitea/demo/demo2/main.tf Normal file
View File

@ -0,0 +1,175 @@
provider "aws" {
region = "ap-northeast-1"
}
resource "aws_vpc" "demo_vpc_main" {
cidr_block = "10.9.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true
tags = {
Name = "demo_vpc_main"
}
}
resource "aws_subnet" "demo_subnet_public_1" {
vpc_id = aws_vpc.demo_vpc_main.id
cidr_block = "10.9.1.0/24"
map_public_ip_on_launch = true
availability_zone = "ap-northeast-1a"
tags = {
Name = "demo_subnet_public_1"
}
}
resource "aws_subnet" "demo_subnet_public_2" {
vpc_id = aws_vpc.demo_vpc_main.id
cidr_block = "10.9.2.0/24"
map_public_ip_on_launch = true
availability_zone = "ap-northeast-1c"
tags = {
Name = "demo_subnet_public_2"
}
}
resource "aws_internet_gateway" "demo_igw_main" {
vpc_id = aws_vpc.demo_vpc_main.id
tags = {
Name = "demo_igw_main"
}
}
resource "aws_route_table" "demo_route_table_main" {
vpc_id = aws_vpc.demo_vpc_main.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.demo_igw_main.id
}
tags = {
Name = "demo_route_table_main"
}
}
resource "aws_route_table_association" "demo_assoc_public_1" {
subnet_id = aws_subnet.demo_subnet_public_1.id
route_table_id = aws_route_table.demo_route_table_main.id
}
resource "aws_route_table_association" "demo_assoc_public_2" {
subnet_id = aws_subnet.demo_subnet_public_2.id
route_table_id = aws_route_table.demo_route_table_main.id
}
resource "aws_security_group" "demo_sg_web" {
vpc_id = aws_vpc.demo_vpc_main.id
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "demo_sg_web"
}
}
resource "aws_instance" "demo_web_1" {
ami = "ami-0f75d1a8c9141bd00"
instance_type = "t2.micro"
subnet_id = aws_subnet.demo_subnet_public_1.id
security_groups = [aws_security_group.demo_sg_web.id]
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y httpd
echo "<html><body><h1>Terraformで作成されたWebサーバ</h1></body></html>" > /var/www/html/index.html
systemctl enable httpd
systemctl start httpd
EOF
tags = {
Name = "demo_web_1"
}
}
resource "aws_instance" "demo_web_2" {
ami = "ami-0f75d1a8c9141bd00"
instance_type = "t2.micro"
subnet_id = aws_subnet.demo_subnet_public_2.id
security_groups = [aws_security_group.demo_sg_web.id]
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y httpd
echo "<html><body><h1>Terraformで作成されたWebサーバ</h1></body></html>" > /var/www/html/index.html
systemctl enable httpd
systemctl start httpd
EOF
tags = {
Name = "demo_web_2"
}
}
resource "aws_lb" "demo_lb_main" {
name = "demo-lb-main"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.demo_sg_web.id]
subnets = [
aws_subnet.demo_subnet_public_1.id,
aws_subnet.demo_subnet_public_2.id
]
tags = {
Name = "demo_lb_main"
}
}
resource "aws_lb_target_group" "demo_tg_web" {
name = "demo-tg-web"
port = 80
protocol = "HTTP"
vpc_id = aws_vpc.demo_vpc_main.id
tags = {
Name = "demo_tg_web"
}
}
resource "aws_lb_target_group_attachment" "demo_attach_web_1" {
target_group_arn = aws_lb_target_group.demo_tg_web.arn
target_id = aws_instance.demo_web_1.id
port = 80
}
resource "aws_lb_target_group_attachment" "demo_attach_web_2" {
target_group_arn = aws_lb_target_group.demo_tg_web.arn
target_id = aws_instance.demo_web_2.id
port = 80
}
resource "aws_lb_listener" "demo_listener_http" {
load_balancer_arn = aws_lb.demo_lb_main.arn
port = 80
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.demo_tg_web.arn
}
}

View File

@ -0,0 +1,3 @@
[default]
region = ap-northeast-1

View File

@ -0,0 +1,4 @@
[default]
aws_access_key_id = AKIARMLXVAFFJJ7YJACG
aws_secret_access_key = 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

2
root/IAM-Users/init.sh Normal file
View File

@ -0,0 +1,2 @@
export AWS_SHARED_CREDENTIALS_FILE=/root/IAM-Users/aws-credentials/credentials
export AWS_CONFIG_FILE=/root/IAM-Users/aws-credentials/config

View File

@ -0,0 +1,25 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/aws" {
version = "5.54.1"
constraints = "~> 5.54.1"
hashes = [
"h1:SOdZNOAcBvbrkV6V1S7UiGh9K//O66qfyXpHgyXeBeI=",
"zh:37c09b9a0a0a2f7854fe52c6adb15f71593810b458a8283ed71d68036af7ba3a",
"zh:42fe11d87723d4e43b9c6224ae6bacdcb53faee8abc58f0fc625a161d1f71cb1",
"zh:57c6dfc46f28c9c2737559bd84acbc05aeae90431e731bb72a0024028a2d2412",
"zh:5ba9665a4ca0e182effd75575b19a4d47383ec02662024b9fe26f78286c36619",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:b55980be0237644123a02a30b56d4cc03863ef29036c47d6e8ab5429ab45adf5",
"zh:b81e7664f10855a3a6fc234a18b4c4f1456273126a40c41516f2061696fb9870",
"zh:bd09736ffafd92af104c3c34b5add138ae8db4402eb687863ce472ca7e5ff2e2",
"zh:cc2eb1c62fba2a11d1f239e650cc2ae94bcab01c907384dcf2e213a6ee1bd5b2",
"zh:e5dc40205d9cf6f353c0ca532ae29afc6c83928bc9bcca47d74b640d3bb5a38c",
"zh:ebf1acdcd13f10db1b9c85050ddaadc70ab269c47c5a240753362446442d8371",
"zh:f2fc28a4ad94af5e6144a7309286505e3eb7a94d9dc106722b506c372ff7f591",
"zh:f49445e8435944df122aa89853260a2716ba8b73d6a6a70cae1661554926d5a2",
"zh:fc3b5046e60ae7cab20715be23de8436eb12736136fd6d0f0cc1549ebda6cc73",
"zh:fdb98a53500e245a3b5bec077b994da6959dba8fc4eb7534528658d820e06bd5",
]
}

View File

@ -0,0 +1,375 @@
Copyright (c) 2017 HashiCorp, Inc.
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

View File

@ -0,0 +1,71 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:AssociateRouteTable",
"ec2:AssociateSubnetCidrBlock",
"ec2:AttachInternetGateway",
"ec2:AuthorizeSecurityGroupEgress",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:CreateInternetGateway",
"ec2:CreateRoute",
"ec2:CreateRouteTable",
"ec2:CreateSecurityGroup",
"ec2:CreateSubnet",
"ec2:CreateTags",
"ec2:CreateVPC",
"ec2:DeleteInternetGateway",
"ec2:DeleteRouteTable",
"ec2:DeleteSecurityGroup",
"ec2:DeleteSubnet",
"ec2:DeleteTags",
"ec2:DeleteVPC",
"ec2:DescribeAccountAttributes",
"ec2:DescribeInstanceAttribute",
"ec2:DescribeInstanceCreditSpecifications",
"ec2:DescribeInstanceTypes",
"ec2:DescribeInstances",
"ec2:DescribeInternetGateways",
"ec2:DescribeNetworkAcls",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribeRouteTables",
"ec2:DescribeSecurityGroups",
"ec2:DescribeSubnets",
"ec2:DescribeTags",
"ec2:DescribeVolumes",
"ec2:DescribeVpcAttribute",
"ec2:DescribeVpcs",
"ec2:DetachInternetGateway",
"ec2:DisassociateRouteTable",
"ec2:DisassociateSubnetCidrBlock",
"ec2:ModifyInstanceAttribute",
"ec2:ModifySubnetAttribute",
"ec2:ModifyVpcAttribute",
"ec2:ModifyVpcTenancy",
"ec2:ReplaceRouteTableAssociation",
"ec2:RevokeSecurityGroupEgress",
"ec2:RevokeSecurityGroupIngress",
"ec2:RunInstances",
"ec2:StartInstances",
"ec2:StopInstances",
"ec2:TerminateInstances"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"ssm:GetParameter"
],
"Resource": [
"*"
]
}
]
}

Some files were not shown because too many files have changed in this diff Show More