From 0c417e0d497deedc572d2eb30e4dcb20420f2f98 Mon Sep 17 00:00:00 2001 From: umarali-nagoor Date: Tue, 24 Nov 2020 13:37:02 +0530 Subject: [PATCH] source path pointing to hashicorp regsitry --- README.md | 46 ++++++++++------- examples/{cos_bucket => bucket}/README.md | 27 ++++++---- examples/bucket/main.tf | 31 ++++++++++++ examples/{cos_bucket => bucket}/variables.tf | 0 examples/{cos_bucket => bucket}/versions.tf | 0 .../.terraform/modules/modules.json | 1 - .../.terraform/plugins/darwin_amd64/lock.json | 3 -- examples/cos_bucket/main.tf | 30 ----------- .../.terraform/modules/modules.json | 1 - .../.terraform/plugins/darwin_amd64/lock.json | 3 -- .../README.md | 19 ++++--- .../main.tf | 13 ++--- .../variables.tf | 0 .../versions.tf | 0 modules/bucket/README.md | 49 ++++++++++++++++++ modules/{cos_bucket => bucket}/main.tf | 8 +-- modules/{cos_bucket => bucket}/output.tf | 0 modules/{cos_bucket => bucket}/variables.tf | 0 modules/cos_bucket/README.md | 50 ------------------- modules/cos_instance/README.md | 38 -------------- modules/storage-instance/README.md | 36 +++++++++++++ .../main.tf | 0 .../output.tf | 0 .../variables.tf | 0 24 files changed, 183 insertions(+), 172 deletions(-) rename examples/{cos_bucket => bucket}/README.md (68%) create mode 100644 examples/bucket/main.tf rename examples/{cos_bucket => bucket}/variables.tf (100%) rename examples/{cos_bucket => bucket}/versions.tf (100%) delete mode 100644 examples/cos_bucket/.terraform/modules/modules.json delete mode 100755 examples/cos_bucket/.terraform/plugins/darwin_amd64/lock.json delete mode 100644 examples/cos_bucket/main.tf delete mode 100644 examples/cos_instance/.terraform/modules/modules.json delete mode 100755 examples/cos_instance/.terraform/plugins/darwin_amd64/lock.json rename examples/{cos_instance => storage-instance}/README.md (70%) rename examples/{cos_instance => storage-instance}/main.tf (51%) rename examples/{cos_instance => storage-instance}/variables.tf (100%) rename examples/{cos_instance => storage-instance}/versions.tf (100%) create mode 100644 modules/bucket/README.md rename modules/{cos_bucket => bucket}/main.tf (50%) rename modules/{cos_bucket => bucket}/output.tf (100%) rename modules/{cos_bucket => bucket}/variables.tf (100%) delete mode 100644 modules/cos_bucket/README.md delete mode 100644 modules/cos_instance/README.md create mode 100644 modules/storage-instance/README.md rename modules/{cos_instance => storage-instance}/main.tf (100%) rename modules/{cos_instance => storage-instance}/output.tf (100%) rename modules/{cos_instance => storage-instance}/variables.tf (100%) diff --git a/README.md b/README.md index 28d1fece..92f01493 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,21 @@ is [1.1.1][v1.1.1]. Full examples are in the [examples](./examples/) folder, but basic usage is as follows for creation of COS instance: ```hcl +provider "ibm" { +} + data "ibm_resource_group" "cos_group" { - name = "test" + name = var.resource_group } module "cos" { - source = "../../modules/cos_instance" - - name = "testcos" - resource_group_id = data.ibm_resource_group.cos_group.id - plan = "testplan" - location = "testregion" + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region } ``` @@ -34,26 +38,30 @@ module "cos" { Creation of cloud object storage bucket: ```hcl +provider "ibm" { +} + data "ibm_resource_group" "cos_group" { - name = "test" + name = var.resource_group } module "cos" { - source = "../../modules/cos_instance" - - name = "testcos" - resource_group_id = data.ibm_resource_group.cos_group.id - plan = "testplan" - location = "testregion" + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region } module "cos_bucket" { - source = "../../modules/cos_bucket" + source = "terraform-ibm-modules/cos/ibm//modules/cos_bucket" - bucket_name = "testbucket" - resource_instance_id = module.cos.cos_instance_id - cross_region_location = "testlocation" - storage_class = "teststorage" + bucket_name = var.bucket_name + cos_instance_id = module.cos.cos_instance_id + location = var.location + storage_class = var.storage_class } ``` diff --git a/examples/cos_bucket/README.md b/examples/bucket/README.md similarity index 68% rename from examples/cos_bucket/README.md rename to examples/bucket/README.md index 0e6a9c16..7841ff72 100644 --- a/examples/cos_bucket/README.md +++ b/examples/bucket/README.md @@ -4,26 +4,30 @@ This module is used to create a cloud object storage bucket ## Example Usage ``` +provider "ibm" { +} + data "ibm_resource_group" "cos_group" { name = var.resource_group } module "cos" { - source = "../../modules/cos_instance" - - name = var.name - resource_group_id = data.ibm_resource_group.cos_group.id - plan = var.plan - location = var.region + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region } module "cos_bucket" { - source = "../../modules/cos_bucket" + source = "terraform-ibm-modules/cos/ibm//modules/cos_bucket" - bucket_name = var.bucket_name - resource_instance_id = module.cos.cos_instance_id - cross_region_location = var.location - storage_class = var.storage_class + bucket_name = var.bucket_name + cos_instance_id = module.cos.cos_instance_id + location = var.location + storage_class = var.storage_class } ``` @@ -42,3 +46,4 @@ module "cos_bucket" { | region | Target location or environment to create the resource instance. | string | n/a | yes | | resource\_group | Name of the resource group | string | n/a | yes | +## NOTE: If we want to make use of a particular version of module, then set the argument "version" to respective module version. \ No newline at end of file diff --git a/examples/bucket/main.tf b/examples/bucket/main.tf new file mode 100644 index 00000000..a4bc42c0 --- /dev/null +++ b/examples/bucket/main.tf @@ -0,0 +1,31 @@ +##################################################### +# COS Bucket +# Copyright 2020 IBM +##################################################### + +provider "ibm" { +} + +data "ibm_resource_group" "cos_group" { + name = var.resource_group +} + +module "cos" { + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region +} + +module "cos_bucket" { + source = "terraform-ibm-modules/cos/ibm//modules/cos_bucket" + + bucket_name = var.bucket_name + cos_instance_id = module.cos.cos_instance_id + location = var.location + storage_class = var.storage_class + +} \ No newline at end of file diff --git a/examples/cos_bucket/variables.tf b/examples/bucket/variables.tf similarity index 100% rename from examples/cos_bucket/variables.tf rename to examples/bucket/variables.tf diff --git a/examples/cos_bucket/versions.tf b/examples/bucket/versions.tf similarity index 100% rename from examples/cos_bucket/versions.tf rename to examples/bucket/versions.tf diff --git a/examples/cos_bucket/.terraform/modules/modules.json b/examples/cos_bucket/.terraform/modules/modules.json deleted file mode 100644 index 3bcbd7b6..00000000 --- a/examples/cos_bucket/.terraform/modules/modules.json +++ /dev/null @@ -1 +0,0 @@ -{"Modules":[{"Key":"cos_bucket","Source":"../../modules/cos_bucket","Dir":"../../modules/cos_bucket"},{"Key":"","Source":"","Dir":"."},{"Key":"cos","Source":"../../modules/cos_instance","Dir":"../../modules/cos_instance"}]} \ No newline at end of file diff --git a/examples/cos_bucket/.terraform/plugins/darwin_amd64/lock.json b/examples/cos_bucket/.terraform/plugins/darwin_amd64/lock.json deleted file mode 100755 index e07e37a1..00000000 --- a/examples/cos_bucket/.terraform/plugins/darwin_amd64/lock.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ibm": "fd20d2dfc5c2bce963c58f8db1c108c5e395095628d1f6d4303dc4b1d3db2c4f" -} \ No newline at end of file diff --git a/examples/cos_bucket/main.tf b/examples/cos_bucket/main.tf deleted file mode 100644 index c83fb761..00000000 --- a/examples/cos_bucket/main.tf +++ /dev/null @@ -1,30 +0,0 @@ -##################################################### -# COS Bucket -# Copyright 2020 IBM -##################################################### - -provider "ibm" { -} - -data "ibm_resource_group" "cos_group" { - name = var.resource_group -} - -module "cos" { - source = "../../modules/cos_instance" - - service_name = var.service_name - resource_group_id = data.ibm_resource_group.cos_group.id - plan = var.plan - region = var.region -} - -module "cos_bucket" { - source = "../../modules/cos_bucket" - - bucket_name = var.bucket_name - cos_instance_id = module.cos.cos_instance_id - location = var.location - storage_class = var.storage_class - -} \ No newline at end of file diff --git a/examples/cos_instance/.terraform/modules/modules.json b/examples/cos_instance/.terraform/modules/modules.json deleted file mode 100644 index 3982d098..00000000 --- a/examples/cos_instance/.terraform/modules/modules.json +++ /dev/null @@ -1 +0,0 @@ -{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"cos","Source":"../../modules/cos_instance","Dir":"../../modules/cos_instance"}]} \ No newline at end of file diff --git a/examples/cos_instance/.terraform/plugins/darwin_amd64/lock.json b/examples/cos_instance/.terraform/plugins/darwin_amd64/lock.json deleted file mode 100755 index e07e37a1..00000000 --- a/examples/cos_instance/.terraform/plugins/darwin_amd64/lock.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ibm": "fd20d2dfc5c2bce963c58f8db1c108c5e395095628d1f6d4303dc4b1d3db2c4f" -} \ No newline at end of file diff --git a/examples/cos_instance/README.md b/examples/storage-instance/README.md similarity index 70% rename from examples/cos_instance/README.md rename to examples/storage-instance/README.md index 7896f0b2..bd44af19 100644 --- a/examples/cos_instance/README.md +++ b/examples/storage-instance/README.md @@ -4,21 +4,28 @@ This module is used to create a cloud object storage instance. ## Example Usage ``` +provider "ibm" { +} + data "ibm_resource_group" "cos_group" { name = var.resource_group } module "cos" { - source = "../../modules/cos_instance" - - name = var.name - resource_group_id = data.ibm_resource_group.cos_group.id - plan = var.plan - location = var.location + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region } ``` +## NOTE: If we want to make use of a particular version of module, then set the argument "version" to respective module version. + + ## Inputs | Name | Description | Type | Default | Required | diff --git a/examples/cos_instance/main.tf b/examples/storage-instance/main.tf similarity index 51% rename from examples/cos_instance/main.tf rename to examples/storage-instance/main.tf index 4649cc5f..b9d87b6f 100644 --- a/examples/cos_instance/main.tf +++ b/examples/storage-instance/main.tf @@ -11,10 +11,11 @@ data "ibm_resource_group" "cos_group" { } module "cos" { - source = "../../modules/cos_instance" - - service_name = var.service_name - resource_group_id = data.ibm_resource_group.cos_group.id - plan = var.plan - region = var.region + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region } \ No newline at end of file diff --git a/examples/cos_instance/variables.tf b/examples/storage-instance/variables.tf similarity index 100% rename from examples/cos_instance/variables.tf rename to examples/storage-instance/variables.tf diff --git a/examples/cos_instance/versions.tf b/examples/storage-instance/versions.tf similarity index 100% rename from examples/cos_instance/versions.tf rename to examples/storage-instance/versions.tf diff --git a/modules/bucket/README.md b/modules/bucket/README.md new file mode 100644 index 00000000..7841ff72 --- /dev/null +++ b/modules/bucket/README.md @@ -0,0 +1,49 @@ +# Module cos_bucket + +This module is used to create a cloud object storage bucket + +## Example Usage +``` +provider "ibm" { +} + +data "ibm_resource_group" "cos_group" { + name = var.resource_group +} + +module "cos" { + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region +} + +module "cos_bucket" { + source = "terraform-ibm-modules/cos/ibm//modules/cos_bucket" + + bucket_name = var.bucket_name + cos_instance_id = module.cos.cos_instance_id + location = var.location + storage_class = var.storage_class + +} +``` + + +## Inputs + + +| Name | Description | Type | Default | Required | +|-----------------|------------------------------------------------------------------|:-------|---------|----------| +| bucket\_name | Name of the bucket | string | n/a | yes | +| storage\_class | Storage class to use for the bucket | string | n/a | yes | +| location | The location of a regional bucket | string | n/a | no | +| name | A descriptive name used to identify the resource instance | string | n/a | yes | +| plan | The name of the plan type supported by service. | string | n/a | yes | +| region | Target location or environment to create the resource instance. | string | n/a | yes | +| resource\_group | Name of the resource group | string | n/a | yes | + +## NOTE: If we want to make use of a particular version of module, then set the argument "version" to respective module version. \ No newline at end of file diff --git a/modules/cos_bucket/main.tf b/modules/bucket/main.tf similarity index 50% rename from modules/cos_bucket/main.tf rename to modules/bucket/main.tf index b28d5f83..be59cb62 100644 --- a/modules/cos_bucket/main.tf +++ b/modules/bucket/main.tf @@ -4,8 +4,8 @@ ##################################################### resource "ibm_cos_bucket" "testBucket" { - bucket_name = var.bucket_name - resource_instance_id = var.cos_instance_id - cross_region_location = var.location - storage_class = var.storage_class + bucket_name = var.bucket_name + resource_instance_id = var.cos_instance_id + cross_region_location = var.location + storage_class = var.storage_class } \ No newline at end of file diff --git a/modules/cos_bucket/output.tf b/modules/bucket/output.tf similarity index 100% rename from modules/cos_bucket/output.tf rename to modules/bucket/output.tf diff --git a/modules/cos_bucket/variables.tf b/modules/bucket/variables.tf similarity index 100% rename from modules/cos_bucket/variables.tf rename to modules/bucket/variables.tf diff --git a/modules/cos_bucket/README.md b/modules/cos_bucket/README.md deleted file mode 100644 index 3e09a7c1..00000000 --- a/modules/cos_bucket/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Module cos_bucket - -This module is used to create a cloud object storage bucket - -## Example Usage -``` -data "ibm_resource_group" "cos_group" { - name = var.resource_group -} - -module "cos" { - source = "../../modules/cos_instance" - - name = var.name - resource_group_id = data.ibm_resource_group.cos_group.id - plan = var.plan - location = var.region -} - -module "cos_bucket" { - source = "../../modules/cos_bucket" - - bucket_name = var.bucket_name - resource_instance_id = module.cos.cos_instance_id - cross_region_location = var.location - storage_class = var.storage_class - -} -``` - - -## Inputs - -| Name | Description | Type | Default | Required | -|-----------------|-----------------------------------------------------------------|:-------|---------|----------| -| bucket\_name | Name of the bucket | string | n/a | yes | -| storage\_class | Storage class to use for the bucket | string | n/a | yes | -| location | The location of a regional bucket | string | n/a | no | -| name | A descriptive name used to identify the resource instance | string | n/a | yes | -| plan | The name of the plan type supported by service. | string | n/a | yes | -| region | Target location or environment to create the resource instance. | string | n/a | yes | -| resource\_group | Name of the resource group | string | n/a | yes | - -## Outputs - -| Name | Description | -|------------------|----------------| -| cos\_\bucket\_id | COS Bucket ID. | - - diff --git a/modules/cos_instance/README.md b/modules/cos_instance/README.md deleted file mode 100644 index fbac6cbb..00000000 --- a/modules/cos_instance/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Module cos_instance - -This module is used to create a cloud object storage instance. - -## Example Usage -``` -data "ibm_resource_group" "cos_group" { - name = var.resource_group -} - -module "cos" { - source = "../../modules/cos_instance" - - name = var.name - resource_group_id = data.ibm_resource_group.cos_group.id - plan = var.plan - location = var.location -} - -``` - - -## Inputs - -| Name | Description | Type | Default | Required | -|-----------------|-----------------------------------------------------------------|:-------|:--------|:---------| -| name | A descriptive name used to identify the resource instance | string | n/a | yes | -| plan | The name of the plan type supported by service. | string | n/a | yes | -| location | Target location or environment to create the resource instance. | string | n/a | yes | -| resource\_group | Name of the resource group | string | n/a | yes | - -## Outputs - -| Name | Description | -|-------------------|------------------| -| cos\_instance\_id | COS Instance ID. | - - \ No newline at end of file diff --git a/modules/storage-instance/README.md b/modules/storage-instance/README.md new file mode 100644 index 00000000..bd44af19 --- /dev/null +++ b/modules/storage-instance/README.md @@ -0,0 +1,36 @@ +# Module cos_instance + +This module is used to create a cloud object storage instance. + +## Example Usage +``` +provider "ibm" { +} + +data "ibm_resource_group" "cos_group" { + name = var.resource_group +} + +module "cos" { + + source = "terraform-ibm-modules/cos/ibm//modules/cos_instance" + + service_name = var.service_name + resource_group_id = data.ibm_resource_group.cos_group.id + plan = var.plan + region = var.region +} + +``` + +## NOTE: If we want to make use of a particular version of module, then set the argument "version" to respective module version. + + +## Inputs + +| Name | Description | Type | Default | Required | +|-----------------|------------------------------------------------------------------|:-------|:------- |:---------| +| name | A descriptive name used to identify the resource instance | string | n/a | yes | +| plan | The name of the plan type supported by service. | string | n/a | yes | +| location | Target location or environment to create the resource instance. | string | n/a | yes | +| resource\_group | Name of the resource group | string | n/a | yes | diff --git a/modules/cos_instance/main.tf b/modules/storage-instance/main.tf similarity index 100% rename from modules/cos_instance/main.tf rename to modules/storage-instance/main.tf diff --git a/modules/cos_instance/output.tf b/modules/storage-instance/output.tf similarity index 100% rename from modules/cos_instance/output.tf rename to modules/storage-instance/output.tf diff --git a/modules/cos_instance/variables.tf b/modules/storage-instance/variables.tf similarity index 100% rename from modules/cos_instance/variables.tf rename to modules/storage-instance/variables.tf