Skip to content

Commit 4d7147c

Browse files
authored
Merge pull request #279 from junior/terraform_updates
Terraform updates
2 parents 94df6b1 + 0f093b7 commit 4d7147c

22 files changed

+412
-407
lines changed

deploy/basic/README.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,9 @@ This creates a `.zip` file in your working directory that can be imported in to
121121
After complete the Build steps 1 and 2, generate the binaries:
122122
123123
1. From the root of the repo execute the command:
124-
* linux/amd64 (or default builder)
125-
126-
```shell
127-
docker run -v $PWD:/transfer --rm --entrypoint cp mushop-basic:latest /package/mushop-basic.tar.xz /transfer/deploy/basic/terraform/scripts/mushop-basic.tar.xz
128-
```
129-
130-
* linux/arm64
131124
132-
```shell
133-
docker run -v $PWD:/transfer --rm --platform linux/arm64 --entrypoint cp mushop-basic-arm64:latest /package/mushop-basic.tar.xz /transfer/deploy/basic/terraform/scripts/mushop-basic.tar.xz
134-
```
135-
136-
```shell
137-
docker run -v $PWD:/transfer --rm --platform linux/arm64 --entrypoint cp mushop-basic-arm64:latest /basic/PLATFORM.auto.tfvars /transfer/deploy/basic/terraform/PLATFORM.auto.tfvars
125+
```shell
126+
docker run -v $PWD:/transfer --rm --entrypoint cp mushop-basic:latest /package/mushop-basic.tar.xz /transfer/deploy/basic/terraform/scripts/mushop-basic.tar.xz
138127
```
139128
140129
1. Copy mushop media images to populate the object storage:
@@ -148,6 +137,7 @@ After complete the Build steps 1 and 2, generate the binaries:
148137
1. Change the credentials variables to your user and any other desirable variables
149138
1. Run `terraform init` to init the terraform providers
150139
1. Run `terraform apply` to create the resources on OCI
140+
1. To show sensitive outputs, use `terraform output autonomous_database_password` to show the ATP Admin password and `terraform output generated_private_key_pem` to show the private key for SSH access
151141
152142
[oci]: https://cloud.oracle.com/en_US/cloud-infrastructure
153143
[orm]: https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/resourcemanager.htm

deploy/basic/terraform/.terraform.lock.hcl

Lines changed: 82 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/basic/terraform/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
2021-06-22 (v2.0.0)
4+
5+
- Updated to use Terraform 1.0.x
6+
- Sensitive fields special treatment
7+
- Terraform providers updated to use newer supported versions. (ORM now is supporting the latest)
8+
- Removal of compatibility workarounds for old/deprecated TF providers
9+
310
2021-06-09 (v1.3.0)
411

512
- Multi Architecture Stack (amd64 and Arm64)

deploy/basic/terraform/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0
1+
2.0.0

deploy/basic/terraform/datasources.tf

Lines changed: 54 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ data "oci_identity_regions" "home_region" {
112112
provider = oci.current_region
113113
}
114114

115+
# Available Services
116+
data "oci_core_services" "all_services" {
117+
filter {
118+
name = "name"
119+
values = ["All .* Services In Oracle Services Network"]
120+
regex = true
121+
}
122+
}
123+
115124
# Cloud Init
116125
data "template_cloudinit_config" "nodes" {
117126
gzip = true
@@ -120,79 +129,60 @@ data "template_cloudinit_config" "nodes" {
120129
part {
121130
filename = "cloud-config.yaml"
122131
content_type = "text/cloud-config"
123-
content = data.template_file.cloud_init.rendered
124-
}
125-
}
126-
data "template_file" "cloud_init" {
127-
template = file("${path.module}/scripts/cloud-config.template.yaml")
128-
129-
vars = {
130-
setup_preflight_sh_content = base64gzip(data.template_file.setup_preflight.rendered)
131-
setup_template_sh_content = base64gzip(data.template_file.setup_template.rendered)
132-
deploy_template_content = base64gzip(data.template_file.deploy_template.rendered)
133-
catalogue_sql_template_content = base64gzip(data.template_file.catalogue_sql_template.rendered)
134-
httpd_conf_content = base64gzip(data.local_file.httpd_conf.content)
135-
mushop_media_pars_list_content = base64gzip(data.template_file.mushop_media_pars_list.rendered)
136-
catalogue_password = random_string.catalogue_db_password.result
137-
catalogue_port = local.catalogue_port
138-
catalogue_architecture = split("/", local.compute_platform)[1]
139-
mock_mode = var.services_in_mock_mode
140-
db_name = oci_database_autonomous_database.mushop_autonomous_database.db_name
141-
assets_url = var.object_storage_mushop_media_visibility == "Private" ? "" : "https://objectstorage.${var.region}.oraclecloud.com/n/${oci_objectstorage_bucket.mushop_media.namespace}/b/${oci_objectstorage_bucket.mushop_media.name}/o/"
142-
}
143-
}
144-
data "template_file" "setup_preflight" {
145-
template = file("${path.module}/scripts/setup.preflight.sh")
146-
}
147-
data "template_file" "setup_template" {
148-
template = file("${path.module}/scripts/setup.template.sh")
149-
150-
vars = {
151-
oracle_client_version = var.oracle_client_version
152-
}
153-
}
154-
data "template_file" "deploy_template" {
155-
template = file("${path.module}/scripts/deploy.template.sh")
156-
157-
vars = {
158-
oracle_client_version = var.oracle_client_version
159-
db_name = oci_database_autonomous_database.mushop_autonomous_database.db_name
160-
atp_pw = random_string.autonomous_database_admin_password.result
161-
mushop_media_visibility = var.object_storage_mushop_media_visibility
162-
mushop_app_par = "https://objectstorage.${var.region}.oraclecloud.com${oci_objectstorage_preauthrequest.mushop_lite_preauth.access_uri}"
163-
wallet_par = "https://objectstorage.${var.region}.oraclecloud.com${oci_objectstorage_preauthrequest.mushop_wallet_preauth.access_uri}"
132+
content = local.cloud_init
164133
}
165134
}
166-
data "template_file" "catalogue_sql_template" {
167-
template = file("${path.module}/scripts/catalogue.template.sql")
168135

169-
vars = {
170-
catalogue_password = random_string.catalogue_db_password.result
171-
}
172-
}
173-
data "local_file" "httpd_conf" {
174-
filename = "${path.module}/scripts/httpd.conf"
175-
}
176-
data "template_file" "mushop_media_pars_list" {
177-
template = file("./scripts/mushop_media_pars_list.txt")
178-
vars = {
179-
content = local.mushop_media_pars
180-
}
181-
}
136+
## Files and Templatefiles
137+
locals {
138+
httpd_conf = file("${path.module}/scripts/httpd.conf")
139+
setup_preflight = file("${path.module}/scripts/setup.preflight.sh")
140+
setup_template = templatefile("${path.module}/scripts/setup.template.sh",
141+
{
142+
oracle_client_version = var.oracle_client_version
143+
})
144+
deploy_template = templatefile("${path.module}/scripts/deploy.template.sh",
145+
{
146+
oracle_client_version = var.oracle_client_version
147+
db_name = oci_database_autonomous_database.mushop_autonomous_database.db_name
148+
atp_pw = random_string.autonomous_database_admin_password.result
149+
mushop_media_visibility = var.object_storage_mushop_media_visibility
150+
mushop_app_par = "https://objectstorage.${var.region}.oraclecloud.com${oci_objectstorage_preauthrequest.mushop_lite_preauth.access_uri}"
151+
wallet_par = "https://objectstorage.${var.region}.oraclecloud.com${oci_objectstorage_preauthrequest.mushop_wallet_preauth.access_uri}"
152+
})
153+
catalogue_sql_template = templatefile("${path.module}/scripts/catalogue.template.sql",
154+
{
155+
catalogue_password = random_string.catalogue_db_password.result
156+
})
157+
mushop_media_pars_list = templatefile("${path.module}/scripts/mushop_media_pars_list.txt",
158+
{
159+
content = local.mushop_media_pars
160+
})
161+
cloud_init = templatefile("${path.module}/scripts/cloud-config.template.yaml",
162+
{
163+
setup_preflight_sh_content = base64gzip(local.setup_preflight)
164+
setup_template_sh_content = base64gzip(local.setup_template)
165+
deploy_template_content = base64gzip(local.deploy_template)
166+
catalogue_sql_template_content = base64gzip(local.catalogue_sql_template)
167+
httpd_conf_content = base64gzip(local.httpd_conf)
168+
mushop_media_pars_list_content = base64gzip(local.mushop_media_pars_list)
169+
catalogue_password = random_string.catalogue_db_password.result
170+
catalogue_port = local.catalogue_port
171+
catalogue_architecture = split("/", local.compute_platform)[1]
172+
mock_mode = var.services_in_mock_mode
173+
db_name = oci_database_autonomous_database.mushop_autonomous_database.db_name
174+
assets_url = var.object_storage_mushop_media_visibility == "Private" ? "" : "https://objectstorage.${var.region}.oraclecloud.com/n/${oci_objectstorage_bucket.mushop_media.namespace}/b/${oci_objectstorage_bucket.mushop_media.name}/o/"
175+
})
176+
}
177+
178+
# Catalogue port
182179
locals {
183180
catalogue_port = 3005
184181
}
185182

186183

187-
# Available Services
188-
data "oci_core_services" "all_services" {
189-
filter {
190-
name = "name"
191-
values = ["All .* Services In Oracle Services Network"]
192-
regex = true
193-
}
194-
}
195184

185+
# Tags
196186
locals {
197187
common_tags = {
198188
Reference = "Created by OCI QuickStart for MuShop Basic demo"

0 commit comments

Comments
 (0)