Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support for new quotas submodule and standard DA #208

Merged
merged 37 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
013f47c
support for da
Soaib024 Oct 16, 2024
a2669a1
add reference diagram
Soaib024 Oct 17, 2024
b0f689f
add test
Soaib024 Oct 18, 2024
f366ed3
update release
Soaib024 Oct 18, 2024
71fc794
update icon image
Soaib024 Oct 18, 2024
78aad4b
update readme
Soaib024 Oct 18, 2024
2a2aac2
update docs
Soaib024 Oct 18, 2024
4e811e3
fix cra scan
Soaib024 Oct 18, 2024
6dd3868
SKIP UPGRADE TEST
Soaib024 Oct 18, 2024
2b82a3c
add catalog id
Soaib024 Oct 18, 2024
607a400
update description
Soaib024 Oct 18, 2024
fb78118
Merge branch 'main' into add-da
Soaib024 Oct 21, 2024
4cb6a52
Merge branch 'main' into add-da
Soaib024 Oct 25, 2024
a22dce2
address review comments
Soaib024 Oct 23, 2024
7b95ffe
address review-comments
Soaib024 Oct 25, 2024
1e485f0
address review comments
Soaib024 Oct 29, 2024
d756ece
update diagram
Soaib024 Oct 29, 2024
a1c3c1f
add provider alias
Soaib024 Oct 29, 2024
91c68d6
support existing namespace
Soaib024 Oct 29, 2024
fbceddb
Merge branch 'main' into add-da
Soaib024 Oct 29, 2024
7b17f59
update test
Soaib024 Oct 30, 2024
28525dc
update description
Soaib024 Oct 30, 2024
5c2bf03
address review comment
Soaib024 Nov 2, 2024
63d26c8
fix pre-commit
Soaib024 Nov 2, 2024
7cbfbb3
Merge branch 'main' into add-da
Soaib024 Nov 3, 2024
5238e4a
fix cra
Soaib024 Nov 3, 2024
eaf6189
update test
Soaib024 Nov 3, 2024
ada1b29
address review comments
Soaib024 Nov 7, 2024
6c6876f
fix: update namespace module
Nov 25, 2024
9db09d6
Merge branch 'main' of https://github.com/terraform-ibm-modules/terra…
Nov 25, 2024
6a9c7f9
add existing resource test & update example
Nov 25, 2024
60d2c9b
resolve pre-commit issues
Nov 25, 2024
1f888a0
update cra config
Nov 25, 2024
8b0520b
remove typo
Nov 25, 2024
cf2a0af
resolve pre-commit issues
Nov 25, 2024
e810475
resolve comments
Nov 25, 2024
304a4d9
update test
Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .catalog-onboard-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
offerings:
- name: deploy-arch-ibm-container-registry
kind: solution
catalog_id: 7df1e4ca-d54c-4fd0-82ce-3d13247308cd
offering_id: 5947efd7-d52a-4905-8052-45f1142f78a0
variations:
- name: standard
mark_ready: true
install_type: fullstack
scc:
instance_id: 1c7d5f78-9262-44c3-b779-b28fe4d88c37
region: us-south
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Primary owner should be listed first in list of global owners, follwed by any secondary owners

* @shemau @daniel-butler-irl
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ repository:

# Uncomment this topics property
# and add a comma-separated list of topics to set on the repo.
topics: core-team, terraform, ibm-cloud, terraform-module, supported, graduated
topics: core-team, terraform, ibm-cloud, terraform-module, supported, graduated, deployable-architecture
3 changes: 3 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
}],
["@semantic-release/exec", {
"successCmd": "echo \"SEMVER_VERSION=${nextRelease.version}\" >> $GITHUB_ENV"
}],
["@semantic-release/exec",{
"publishCmd": "./ci/trigger-catalog-onboarding-pipeline.sh --version=v${nextRelease.version}"
}]
]
}
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ You can use this module to provision and configure an [IBM Container Registry](h
* [terraform-ibm-container-registry](#terraform-ibm-container-registry)
* [Submodules](./modules)
* [plan](./modules/plan)
* [quotas](./modules/quotas)
* [Examples](./examples)
* [IBM Container Registry namespace example](./examples/namespace)
* [IBM Container Registry namespace example](./examples/complete)
* [Contributing](#contributing)
<!-- END OVERVIEW HOOK -->

Expand All @@ -27,11 +28,25 @@ You can use this module to provision and configure an [IBM Container Registry](h
```hcl
module "namespace" {
source = "terraform-ibm-modules/container-registry/ibm"
version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
name = "my-namespace"
version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
namespace_name = "my-namespace"
namespace_region = "us-south"
resource_group_id = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX"
images_per_repo = 2
}

module "upgrade-plan" {
source = "terraform-ibm-modules/container-registry/ibm//modules/plan"
version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
}
module "set_quota" {
source = "terraform-ibm-modules/container-registry/ibm//modules/quotas"
version = "X.Y.Z" # Replace "X.Y.Z" with a release version to lock into a specific release
update_storage_quota = true
storage_megabytes = 5 * 1024 # 5GiB
update_traffic_quota = true
traffic_megabytes = 500 # 500 MB
}
```

### Required IAM access policies
Expand Down Expand Up @@ -61,13 +76,15 @@ No modules.
|------|------|
| [ibm_cr_namespace.cr_namespace](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/cr_namespace) | resource |
| [ibm_cr_retention_policy.cr_retention_policy](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/cr_retention_policy) | resource |
| [ibm_cr_namespaces.existing_cr_namespaces](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/cr_namespaces) | data source |

### Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_existing_namespace_name"></a> [existing\_namespace\_name](#input\_existing\_namespace\_name) | The name of an existing namespace. Required if 'namespace\_name' is not provided. | `string` | `null` | no |
| <a name="input_images_per_repo"></a> [images\_per\_repo](#input\_images\_per\_repo) | (Optional, Integer) Determines how many images are retained in each repository when the retention policy is processed. The value -1 denotes Unlimited (all images are retained). The value 0 denotes no retention policy will be created (default) | `number` | `0` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the container registry namespace | `string` | n/a | yes |
| <a name="input_namespace_name"></a> [namespace\_name](#input\_namespace\_name) | Name of the container registry namespace, if var.existing\_namespace\_name is not inputted, a new namespace will be created in a region set by provider. | `string` | n/a | yes |
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the IBM container namespace will be created. | `string` | n/a | yes |
| <a name="input_retain_untagged"></a> [retain\_untagged](#input\_retain\_untagged) | (Optional, Bool) Determines whether untagged images are retained when the retention policy is processed. Default value is false, means untagged images can be deleted when the policy runs. | `bool` | `false` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Optional list of tags to be added to the IBM container namespace. | `list(string)` | `[]` | no |
Expand All @@ -77,6 +94,8 @@ No modules.
| Name | Description |
|------|-------------|
| <a name="output_namespace_crn"></a> [namespace\_crn](#output\_namespace\_crn) | CRN representing the namespace |
| <a name="output_namespace_name"></a> [namespace\_name](#output\_namespace\_name) | Name of ICR namespace |
| <a name="output_retention_policy_id"></a> [retention\_policy\_id](#output\_retention\_policy\_id) | ID of retentation policy |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

<!-- Leave this section as is so that your module has a link to local development environment set up steps for contributors to follow -->
Expand Down
8 changes: 4 additions & 4 deletions cra-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: "v1"
CRA_TARGETS:
- CRA_TARGET: "examples/namespace"
- CRA_TARGET: "solutions/standard"
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json"
PROFILE_ID: "fe96bd4d-9b37-40f2-b39f-a62760e326a3" # SCC profile ID (currently set to 'IBM Cloud Framework for Financial Services' '1.7.0' profile).
# CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs.
# TF_VAR_sample: "sample value"
# TF_VAR_other: "another value"
CRA_ENVIRONMENT_VARIABLES: # An optional map of environment variables for CRA, where the key is the variable name and value is the value. Useful for providing TF_VARs.
TF_VAR_provider_visibility: "public"
TF_VAR_namespace_region: "us-south"
# SCC_INSTANCE_ID: "" # The SCC instance ID to use to download profile for CRA scan. If not provided, a default global value will be used.
# SCC_REGION: "" # The IBM Cloud region that the SCC instance is in. If not provided, a default global value will be used.
# PROFILE_ID: "" # The Profile ID input for CRA SCC scan. Ensure to use a US-specific ID. If not provided, a default global value will be used.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# IBM Container Registry namespace example

This example creates the following infrastructure:

- A new resource group, if one is not passed in.
- A new IBM Container Registry namespace.
- Optionally, a new retention policy for the namespace.
34 changes: 34 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
########################################################################################################################
# Resource group
########################################################################################################################

module "resource_group" {
source = "terraform-ibm-modules/resource-group/ibm"
version = "1.1.6"
# if an existing resource group is not set (null) create a new one using prefix
resource_group_name = var.resource_group == null ? "${var.prefix}-resource-group" : null
existing_resource_group_name = var.resource_group
}

module "namespace" {
providers = {
ibm = ibm.namespace
}
source = "../.."
namespace_name = var.prefix == null ? "namespace" : "${var.prefix}-namespace"
existing_namespace_name = var.existing_namespace_name
resource_group_id = module.resource_group.resource_group_id
tags = var.resource_tags
images_per_repo = var.images_per_repo
retain_untagged = var.retain_untagged
}

module "upgrade_plan" {
source = "../..//modules/plan"
}

module "set_quota" {
source = "../../modules/quotas"
storage_megabytes = 5 * 1024 - 1
traffic_megabytes = 499
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

provider "ibm" {
ibmcloud_api_key = var.ibmcloud_api_key
region = var.region
}

provider "ibm" {
alias = "namespace"
ibmcloud_api_key = var.ibmcloud_api_key
region = var.namespace_region
}

# Data source to retrieve token details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ variable "prefix" {
default = "test-icr"
}

variable "region" {
variable "namespace_region" {
type = string
description = "Prefix to append to all resources created by this example"
description = "The IBM Cloud region where the container registry namespace and retention policy will be created or where the existing namespace is located."
default = "us-south"
}

variable "existing_namespace_name" {
type = bool
description = "The name of an existing namespace. Required if `namespace_name` is not provided."
default = null
}

variable "resource_group" {
type = string
description = "An existing resource group name to use for this example, if unset a new resource group will be created"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ terraform {
}
restapi = {
source = "Mastercard/restapi"
version = ">= 1.18.2"
version = ">= 1.20.0"
}
}
}
Loading