Skip to content

Commit 7d369a9

Browse files
committed
tested, updated docs
Signed-off-by: Ali Mukadam <[email protected]> updated copyright dates Signed-off-by: Ali Mukadam <[email protected]> minor doc updates Signed-off-by: Ali Mukadam <[email protected]>
1 parent 6daf8f6 commit 7d369a9

25 files changed

+1436
-1
lines changed

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
# .tfstate files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# .tfvars files
9+
*.tfvars
10+
11+
# provider file for testing - should be manually added
12+
provider.tf
13+
14+
generated/**
15+
scripts/tesseract.sh
16+
17+
# visual code
18+
**/.vscode/*

CHANGELOG.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
= CHANGELOG
2+
:idprefix:
3+
:idseparator: *
4+
5+
:uri-changelog: http://keepachangelog.com/
6+
All notable changes to this project are documented in this file.
7+
8+
The format is based on {uri-changelog}[Keep a Changelog].
9+
10+
== v1.0.0 (May 21,2020)
11+
12+
=== Changes
13+
* First release after split from terraform-oci-base
14+
* changed most variables to simple types
15+
* updated docs

CONTRIBUTING.adoc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
= CONTRIBUTING
2+
3+
:uri-oracle-oca: https://www.oracle.com/technetwork/community/oca-486395.html
4+
5+
Oracle welcomes contributions to this repository from anyone.
6+
7+
If you want to submit a pull request to fix a bug or enhance an existing
8+
feature, please first open an issue and link to that issue when you
9+
submit your pull request.
10+
11+
If you have any questions about a possible submission, feel free to open
12+
an issue too.
13+
14+
== Contributing to the terraform-oci-oke repository
15+
16+
Pull requests can be made under
17+
{uri-oracle-oca}[The Oracle Contributor Agreement](OCA).
18+
19+
For pull requests to be accepted, the bottom of your commit message must have
20+
the following line using your name and e-mail address as it appears in the
21+
OCA Signatories list.
22+
23+
----
24+
Signed-off-by: Your Name <[email protected]>
25+
----
26+
27+
This can be automatically added to pull requests by committing with:
28+
29+
----
30+
git commit --signoff
31+
----
32+
33+
Only pull requests from committers that can be verified as having
34+
signed the OCA can be accepted.
35+
36+
=== Pull request process
37+
38+
. Fork this repository
39+
. Create a branch in your fork to implement the changes. We recommend using
40+
the issue number as part of your branch name, e.g. `1234-fixes`
41+
. Ensure that any documentation is updated with the changes that are required
42+
by your fix.
43+
. Ensure that any samples are updated if the base image has been changed.
44+
. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
45+
what your changes are meant to do and provide simple steps on how to validate
46+
your changes. Ensure that you reference the issue you created as well.
47+
We will assign the pull request to 2-3 people for review before it is merged.

CONTRIBUTORS.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
== GitHub userids of contributors
2+
3+
OWNERS # have admin access and can merge code to master:
4+
5+
- @hyder
6+
- @markxnelson
7+
8+
CONTRIBUTORS
9+
10+
- @karthicgit

LICENSE

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2019, 2020 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.

README.adoc

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
= Terraform Bastion for Oracle Cloud Infrastructure
2+
3+
:idprefix:
4+
:idseparator: -
5+
6+
:uri-repo: https://github.com/oracle-terraform-modules/terraform-oci-bastion
7+
8+
:uri-rel-file-base: link:{uri-repo}/blob/master
9+
:uri-rel-tree-base: link:{uri-repo}/tree/master
10+
11+
:uri-docs: {uri-rel-file-base}/docs
12+
13+
:uri-changelog: {uri-rel-file-base}/CHANGELOG.adoc
14+
15+
:uri-contribute: {uri-rel-file-base}/CONTRIBUTING.adoc
16+
:uri-contributors: {uri-rel-file-base}/CONTRIBUTORS.adoc
17+
18+
:uri-license: {uri-rel-file-base}/LICENSE
19+
:uri-canonical-license: https://oss.oracle.com/licenses/upl/
20+
:uri-networks-subnets-cidr: https://erikberg.com/notes/networks.html
21+
:uri-oci: https://cloud.oracle.com/cloud-infrastructure
22+
:uri-oci-documentation: https://docs.cloud.oracle.com/iaas/Content/home.htm
23+
:uri-oracle: https://www.oracle.com
24+
:uri-prereqs: {uri-docs}/prerequisites.adoc
25+
:uri-quickstart: {uri-docs}/quickstart.adoc
26+
:uri-reuse-module: {uri-rel-tree-base}/examples/
27+
:uri-terraform: https://www.terraform.io
28+
:uri-terraform-cidrsubnet-deconstructed: http://blog.itsjustcode.net/blog/2017/11/18/terraform-cidrsubnet-deconstructed/
29+
:uri-terraform-hashicorp-examples: https://github.com/hashicorp/terraform-guides/tree/master/infrastructure-as-code/terraform-0.12-examples
30+
:uri-terraform-oci: https://www.terraform.io/docs/providers/oci/index.html
31+
:uri-terraform-options: {uri-docs}/terraformoptions.adoc
32+
:uri-terraform-oci-examples: https://github.com/terraform-providers/terraform-provider-oci/tree/master/examples
33+
34+
The {uri-repo}[Terraform OCI Bastion] for {uri-oci}[Oracle Cloud Infrastructure] (OCI) provides a Terraform module that reuses an existing VCN and adds a bastion host to it.
35+
36+
It creates the following resources:
37+
38+
* A configurable security list to allow ssh access from a defined CIDR block
39+
* A public subnet
40+
* A compute instance
41+
* An optional notification via email
42+
43+
This module is primarily meant to be reusable to provide an entry point into your infrastructure on {uri-oci}[OCI].
44+
You can further use it as part of higher level Terraform modules
45+
46+
== {uri-docs}[Documentation]
47+
48+
* {uri-prereqs}[Pre-requisites]
49+
50+
* Instructions
51+
** {uri-quickstart}[Quickstart]
52+
** {uri-reuse-module}[Reusing as a Terraform module]
53+
* {uri-terraform-options}[Terraform Options]
54+
55+
== Related Documentation, Blog
56+
* {uri-oci-documentation}[Oracle Cloud Infrastructure Documentation]
57+
* {uri-terraform-oci}[Terraform OCI Provider Documentation]
58+
* {uri-networks-subnets-cidr}[Erik Berg on Networks, Subnets and CIDR]
59+
* {uri-terraform-cidrsubnet-deconstructed}[Lisa Hagemann on Terraform cidrsubnet Deconstructed]
60+
61+
== Projects using this module
62+
63+
== Changelog
64+
65+
View the {uri-changelog}[CHANGELOG].
66+
67+
== Acknowledgement
68+
69+
Code derived and adapted from {uri-terraform-oci-examples}[Terraform OCI Examples] and Hashicorp's {uri-terraform-hashicorp-examples}[Terraform 0.12 examples]
70+
71+
== Contributors
72+
73+
{uri-contributors}[Folks who contributed with explanations, code, feedback, ideas, testing etc.]
74+
75+
Learn how to {uri-contribute}[contribute].
76+
77+
== License
78+
79+
Copyright(c) 2019,2020 Oracle and/or its associates. All rights reserved.
80+
81+
Licensed under the {uri-license}[Universal Permissive License 1.0] as shown at
82+
{uri-canonical-license}[https://oss.oracle.com/licenses/upl].

README.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,78 @@
1-
# terraform-oci-bastion
1+
# Terraform OCI Bastion for Oracle Cloud Infrastructure
2+
3+
[changelog]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/blob/master/CHANGELOG.adoc
4+
[contributing]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/blob/master/CONTRIBUTING.adoc
5+
[contributors]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/blob/master/CONTRIBUTORS.adoc
6+
[docs]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/tree/master/docs
7+
8+
[license]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/blob/master/LICENSE
9+
[canonical_license]: https://oss.oracle.com/licenses/upl/
10+
11+
[oci]: https://cloud.oracle.com/cloud-infrastructure
12+
[oci_documentation]: https://docs.cloud.oracle.com/iaas/Content/home.htm
13+
14+
[oracle]: https://www.oracle.com
15+
[prerequisites]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/blob/master/docs/prerequisites.adoc
16+
17+
[quickstart]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/blob/master/docs/quickstart.adoc
18+
[repo]: https://github.com/oracle/terraform-oci-bastion
19+
[reuse]: https://github.com/oracle/terraform-oci-bastion/examples/db
20+
[subnets]: https://erikberg.com/notes/networks.html
21+
[terraform]: https://www.terraform.io
22+
[terraform_cidr_subnet]: http://blog.itsjustcode.net/blog/2017/11/18/terraform-cidrsubnet-deconstructed/
23+
[terraform_hashircorp_examples]: https://github.com/hashicorp/terraform-guides/tree/master/infrastructure-as-code/terraform-0.12-examples
24+
[terraform_oci]: https://www.terraform.io/docs/providers/oci/index.html
25+
[terraform_options]: https://github.com/oracle-terraform-modules/terraform-oci-bastion/blob/master/docs/terraformoptions.adoc
26+
[terraform_oci_examples]: https://github.com/terraform-providers/terraform-provider-oci/tree/master/examples
27+
[terraform_oci_oke]: https://github.com/oracle-terraform-modules/terraform-oci-oke
28+
29+
The [Terraform OCI Bastion][repo] for [Oracle Cloud Infrastructure][OCI] provides a [Terraform][terraform] module that reuses an existing VCN and adds a bastion host to it.
30+
31+
It creates the following resources:
32+
33+
* A configurable security list to allow ssh access from a defined CIDR block
34+
* A public subnet
35+
* A compute instance
36+
* An optional notification via email
37+
38+
This module is primarily meant to be reusable to provide an entry point into your infrastructure on {uri-oci}[OCI].
39+
You can further use it as part of higher level Terraform modules
40+
41+
## [Documentation][docs]
42+
43+
### [Pre-requisites][prerequisites]
44+
45+
#### Instructions
46+
- [Quickstart][quickstart]
47+
- [Reusing as a Terraform module][reuse]
48+
- [Terraform Options][terraform_options]
49+
50+
## Related Documentation, Blog
51+
- [Oracle Cloud Infrastructure Documentation][oci_documentation]
52+
- [Terraform OCI Provider Documentation][terraform_oci]
53+
- [Erik Berg on Networks, Subnets and CIDR][subnets]
54+
- [Lisa Hagemann on Terraform cidrsubnet Deconstructed][terraform_cidr_subnet]
55+
56+
## Projects using this module
57+
58+
## Changelog
59+
60+
View the [CHANGELOG][changelog].
61+
62+
## Acknowledgement
63+
64+
Code derived and adapted from [Terraform OCI Examples][terraform_oci_examples] and Hashicorp's [Terraform 0.12 examples][terraform_oci_examples]
65+
66+
## Contributors
67+
68+
[Folks who contributed with explanations, code, feedback, ideas, testing etc.][contributors]
69+
70+
Learn how to [contribute][contributing].
71+
72+
## License
73+
74+
Copyright (c) 2019, 2020 Oracle and/or its associates. All rights reserved.
75+
76+
Licensed under the [Universal Permissive License 1.0][license] as shown at
77+
[https://oss.oracle.com/licenses/upl][canonical_license].
78+

cloudinit/autonomous.template.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2019, 2020 Oracle Corporation and/or affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
#cloud-config
5+
timezone: ${timezone}
6+
7+
write_files:
8+
# setup script
9+
- path: "/root/bastion/notification.sh"
10+
permissions: "0700"
11+
encoding: "gzip+base64"
12+
content: |
13+
${notification_sh_content}
14+
runcmd:
15+
- echo "Configuring running notification script..."
16+
- bash /root/bastion/notification.sh
17+
- touch /home/opc/bastion.finish

compute.tf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2019, 2020 Oracle Corporation and/or affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
resource "oci_core_instance" "bastion" {
5+
availability_domain = element(local.ad_names, (var.availability_domain - 1))
6+
compartment_id = var.compartment_id
7+
freeform_tags = var.tags.compute
8+
9+
10+
create_vnic_details {
11+
assign_public_ip = true
12+
display_name = "${var.label_prefix}-bastion-vnic"
13+
hostname_label = "bastion"
14+
subnet_id = oci_core_subnet.bastion[0].id
15+
}
16+
17+
display_name = "${var.label_prefix}-bastion"
18+
19+
# prevent the bastion from destroying and recreating itself if the image ocid changes
20+
lifecycle {
21+
ignore_changes = [source_details[0].source_id]
22+
}
23+
24+
metadata = {
25+
ssh_authorized_keys = var.ssh_public_key != "" ? var.ssh_public_key : file(var.ssh_public_key_path)
26+
user_data = data.template_cloudinit_config.bastion[0].rendered
27+
}
28+
29+
shape = var.bastion_shape
30+
31+
source_details {
32+
source_type = "image"
33+
source_id = local.bastion_image_id
34+
}
35+
36+
timeouts {
37+
create = "60m"
38+
}
39+
40+
count = var.bastion_enabled == true ? 1 : 0
41+
}

0 commit comments

Comments
 (0)