Skip to content

Commit 53d6797

Browse files
feat: initial module release (#2)
1 parent 38f9d9c commit 53d6797

File tree

16 files changed

+413
-90
lines changed

16 files changed

+413
-90
lines changed

.github/settings.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ repository:
1515
# By changing this field, you rename the repository.
1616

1717
# Uncomment this name property and set the name to the current repo name.
18-
# name: ""
18+
name: "terraform-ibm-app-configuration"
1919

2020
# The description is displayed under the repository name on the
2121
# organization page and in the 'About' section of the repository.
2222

2323
# Uncomment this description property
2424
# and update the description to the current repo description.
25-
# description: ""
25+
description: "Create an App Configuration instance and optionally allows for multiple App Configuration Collections to be created."
2626

2727
# Use a comma-separated list of topics to set on the repo.
2828
topics: terraform, ibm-cloud, terraform-module

.secrets.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2023-06-03T04:42:19Z",
6+
"generated_at": "2023-10-07T00:05:00Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"

README.md

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
<!-- Update the title -->
2-
# Terraform Modules Template Project
1+
# Terraform IBM App Configuration
32

4-
<!--
5-
Update status and "latest release" badges:
6-
1. For the status options, see https://github.ibm.com/GoldenEye/documentation/blob/master/status.md
7-
2. Update the "latest release" badge to point to the correct module's repo. Replace "module-template" in two places.
8-
-->
9-
[![Incubating (Not yet consumable)](https://img.shields.io/badge/status-Incubating%20(Not%20yet%20consumable)-red)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
10-
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-module-template?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-module-template/releases/latest)
3+
[![Stable (Adopted)](https://img.shields.io/badge/Status-Stable%20(Adopted)-yellowgreen?style=plastic)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
4+
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-app-configuration?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-app-configuration/releases/latest)
115
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
126
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
137
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
148

15-
<!-- Add a description of module(s) in this repo -->
16-
9+
Create an App Configuration instance and optionally allows for multiple App Configuration Collections to be created.
1710

1811
<!--
1912
If this repo contains any reference architectures, uncomment the heading below and links to them.
@@ -23,7 +16,6 @@ https://terraform-ibm-modules.github.io/documentation/#/implementation-guideline
2316
-->
2417
<!-- ## Reference architectures -->
2518

26-
2719
<!-- Below content is automatically populated via pre-commit hook -->
2820
<!-- BEGIN OVERVIEW HOOK -->
2921
## Overview
@@ -34,48 +26,51 @@ https://terraform-ibm-modules.github.io/documentation/#/implementation-guideline
3426
* [Contributing](#contributing)
3527
<!-- END OVERVIEW HOOK -->
3628

37-
### Usage
29+
## terraform-ibm-app-configuration
3830

39-
<!--
40-
Add an example of the use of the module in the following code block.
41-
42-
Use real values instead of "var.<var_name>" or other placeholder values
43-
unless real values don't help users know what to change.
44-
-->
31+
### Usage
4532

4633
```hcl
47-
34+
module "app_config" {
35+
source = "terraform-ibm-modules/app-configuration/ibm"
36+
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
37+
resource_group_id = "65xxxxxxxxxxxxxxxa3fd"
38+
region = "us-south"
39+
app_config_name = "my-app-config-name"
40+
app_config_plan = "lite"
41+
app_config_service_endpoints = "public"
42+
app_config_tags = ["list", "of", "tags"]
43+
44+
app_config_collections = [
45+
{
46+
name = "my-app-config-collection-name",
47+
collection_id = "my-app-config-collection-id",
48+
description = "Collection for app config instance",
49+
tags = "tag for collection"
50+
},
51+
{
52+
name = "second-collection-name",
53+
collection_id = "second-collection-id",
54+
description = "Another Collection for app config instance",
55+
tags = "another tag"
56+
}
57+
]
58+
}
4859
```
4960

5061
### Required IAM access policies
5162

52-
<!-- PERMISSIONS REQUIRED TO RUN MODULE
53-
If this module requires permissions, uncomment the following block and update
54-
the sample permissions, following the format.
55-
Replace the sample Account and IBM Cloud service names and roles with the
56-
information in the console at
57-
Manage > Access (IAM) > Access groups > Access policies.
58-
-->
59-
60-
<!--
6163
You need the following permissions to run this module.
6264

63-
- Account Management
64-
- **Sample Account Service** service
65-
- `Editor` platform access
66-
- `Manager` service access
67-
- IAM Services
68-
- **Sample Cloud Service** service
69-
- `Administrator` platform access
70-
-->
71-
72-
<!-- NO PERMISSIONS FOR MODULE
73-
If no permissions are required for the module, uncomment the following
74-
statement instead the previous block.
75-
-->
76-
77-
<!-- No permissions are needed to run this module.-->
65+
* Account Management
66+
* **All Resource Groups** service
67+
* `Viewer` platform access
68+
* IAM Services
69+
* **App Configuration** service
70+
* `Administrator` platform access
71+
* `Manager` service access
7872

73+
For more information on access and permissions, see <https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions#apprapp-roles>
7974

8075
<!-- Below content is automatically populated via pre-commit hook -->
8176
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
@@ -84,22 +79,37 @@ statement instead the previous block.
8479
| Name | Version |
8580
|------|---------|
8681
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0, <1.6.0 |
82+
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.49.0, < 2.0.0 |
8783

8884
### Modules
8985

9086
No modules.
9187

9288
### Resources
9389

94-
No resources.
90+
| Name | Type |
91+
|------|------|
92+
| [ibm_app_config_collection.collections](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/app_config_collection) | resource |
93+
| [ibm_resource_instance.app_config](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_instance) | resource |
9594

9695
### Inputs
9796

98-
No inputs.
97+
| Name | Description | Type | Default | Required |
98+
|------|-------------|------|---------|:--------:|
99+
| <a name="input_app_config_collections"></a> [app\_config\_collections](#input\_app\_config\_collections) | A list of collections to be added to the App Configuration instance | <pre>list(object({<br> name = string<br> collection_id = string<br> description = optional(string, null)<br> tags = optional(string, null)<br> }))</pre> | `[]` | no |
100+
| <a name="input_app_config_name"></a> [app\_config\_name](#input\_app\_config\_name) | Name for the App Configuration service instance | `string` | n/a | yes |
101+
| <a name="input_app_config_plan"></a> [app\_config\_plan](#input\_app\_config\_plan) | Plan for the App Configuration service instance, valid plans are lite, standardv2, and enterprise. | `string` | `"lite"` | no |
102+
| <a name="input_app_config_service_endpoints"></a> [app\_config\_service\_endpoints](#input\_app\_config\_service\_endpoints) | Service Endpoints for the App Configuration service instance, valid endpoints are public or public-and-private. | `string` | `"public-and-private"` | no |
103+
| <a name="input_app_config_tags"></a> [app\_config\_tags](#input\_app\_config\_tags) | Optional list of tags to be added to the App Config instance. | `list(string)` | `[]` | no |
104+
| <a name="input_region"></a> [region](#input\_region) | The region to provision the App Configuration service, valid regions are us-south, us-east, eu-gb, and au-syd. | `string` | `"us-south"` | no |
105+
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where resources will be provisioned. | `string` | n/a | yes |
99106

100107
### Outputs
101108

102-
No outputs.
109+
| Name | Description |
110+
|------|-------------|
111+
| <a name="output_app_config_collection_ids"></a> [app\_config\_collection\_ids](#output\_app\_config\_collection\_ids) | List of IDs for the collections in the App Configuration instance |
112+
| <a name="output_app_config_guid"></a> [app\_config\_guid](#output\_app\_config\_guid) | GUID of the App Configuration instance |
103113
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
104114

105115
<!-- Leave this section as is so that your module has a link to local development environment set up steps for contributors to follow -->

examples/basic/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ The text below should describe exactly what resources are provisioned / configur
77
-->
88

99
An end-to-end basic example that will provision the following:
10+
1011
- A new resource group if one is not passed in.
11-
- A new Cloud Object Storage instance.
12+
- A new App Configuration instance.

examples/basic/main.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ module "resource_group" {
1111
}
1212

1313
########################################################################################################################
14-
# COS instance
14+
# App Config
1515
########################################################################################################################
1616

17-
resource "ibm_resource_instance" "cos_instance" {
18-
name = "${var.prefix}-cos"
17+
module "app_config" {
18+
source = "../.."
1919
resource_group_id = module.resource_group.resource_group_id
20-
service = "cloud-object-storage"
21-
plan = "standard"
22-
location = "global"
23-
tags = var.resource_tags
20+
region = var.region
21+
app_config_name = "${var.prefix}-app-config"
22+
app_config_tags = var.resource_tags
2423
}

examples/basic/outputs.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
# Outputs
33
########################################################################################################################
44

5-
output "cos_instance_id" {
6-
description = "COS instance id"
7-
value = ibm_resource_instance.cos_instance.id
8-
}
9-
105
output "resource_group_name" {
116
description = "Resource group name"
127
value = module.resource_group.resource_group_name
@@ -16,3 +11,8 @@ output "resource_group_id" {
1611
description = "Resource group ID"
1712
value = module.resource_group.resource_group_id
1813
}
14+
15+
output "app_config_guid" {
16+
description = "App Configuration GUID"
17+
value = module.app_config.app_config_guid
18+
}

examples/complete/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22

33
<!-- There is a pre-commit hook that will take the title of each example add include it in the repos main README.md -->
44
<!-- Add text below should describe exactly what resources are provisioned / configured by the example -->
5+
6+
An end-to-end basic example that will provision the following:
7+
8+
- A new resource group if one is not passed in.
9+
- A new App Configuration instance.
10+
- A new collection within the App Configuration instance.

examples/complete/main.tf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
##############################################################################
22
# Complete example
33
##############################################################################
4+
5+
########################################################################################################################
6+
# Resource group
7+
########################################################################################################################
8+
9+
module "resource_group" {
10+
source = "terraform-ibm-modules/resource-group/ibm"
11+
version = "1.1.0"
12+
# if an existing resource group is not set (null) create a new one using prefix
13+
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
14+
existing_resource_group_name = var.resource_group
15+
}
16+
17+
########################################################################################################################
18+
# App Config
19+
########################################################################################################################
20+
21+
module "app_config" {
22+
source = "../.."
23+
resource_group_id = module.resource_group.resource_group_id
24+
region = var.region
25+
app_config_name = "${var.prefix}-app-config"
26+
app_config_tags = var.resource_tags
27+
28+
app_config_collections = [
29+
{
30+
name = "${var.prefix}-collection",
31+
collection_id = "${var.prefix}-collection"
32+
description = "Collection for ${var.prefix}"
33+
}
34+
]
35+
}

examples/complete/outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ output "resource_group_name" {
1717
value = var.resource_group
1818
}
1919

20+
output "app_config_guid" {
21+
description = "App Configuration GUID"
22+
value = module.app_config.app_config_guid
23+
}
24+
25+
output "app_config_collection_ids" {
26+
description = "App Configuration Collection IDs"
27+
value = module.app_config.app_config_collection_ids
28+
}
29+
2030
output "resource_tags" {
2131
description = "List of resource tags"
2232
value = var.resource_tags

main.tf

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1-
/********************************************************************
2-
This file is used to implement the ROOT module.
3-
*********************************************************************/
1+
##############################################################################
2+
# App Config module
3+
##############################################################################
4+
5+
resource "ibm_resource_instance" "app_config" {
6+
resource_group_id = var.resource_group_id
7+
location = var.region
8+
name = var.app_config_name
9+
service = "apprapp"
10+
plan = var.app_config_plan
11+
service_endpoints = var.app_config_service_endpoints
12+
tags = var.app_config_tags
13+
}
14+
15+
locals {
16+
collections_map = {
17+
for obj in var.app_config_collections :
18+
(obj.name) => obj
19+
}
20+
}
21+
22+
resource "ibm_app_config_collection" "collections" {
23+
for_each = local.collections_map
24+
guid = ibm_resource_instance.app_config.guid
25+
name = each.value.name
26+
collection_id = each.value.collection_id
27+
description = each.value.description
28+
tags = each.value.tags
29+
}

0 commit comments

Comments
 (0)