Giter Site home page Giter Site logo

terraform-ibm-modules / terraform-ibm-cos Goto Github PK

View Code? Open in Web Editor NEW
7.0 19.0 21.0 1.19 MB

Configures an IBM Cloud Object Storage instance and bucket

License: Apache License 2.0

HCL 81.18% Go 13.72% Shell 5.11%
terraform-module ibm-cloud cloud-object-storage cos-bucket terraform core-team graduated supported bucket cos

terraform-ibm-cos's Introduction

Cloud Object Storage module

Graduated (Supported) semantic-release pre-commit latest release Renovate enabled Catalog release

Use this module to provision and configure an IBM Cloud Object Storage instance and bucket.

In addition, a buckets submodule supports creating multiple buckets in an existing instance.

You can configure the following aspects of your instances:

Overview

terraform-ibm-cos

Usage

provider "ibm" {
  ibmcloud_api_key = "XXXXXXXXXX"
  region           = "us-south"
}

# Creates:
# - COS instance
# - COS buckets with retention, encryption, monitoring and activity tracking
module "cos_module" {
  source                     = "terraform-ibm-modules/cos/ibm"
  version                    = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
  resource_group_id          = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX"
  region                     = "us-south"
  cos_instance_name          = "my-cos-instance"
  bucket_name                = "my-cos-bucket"
  existing_kms_instance_guid = "xxxxxxxx-XXXX-XXXX-XXXX-xxxxxxxx"
  kms_key_crn                = "crn:v1:bluemix:public:kms:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxxxxx-XXXX-XXXX-XXXX-xxxxxx:key:xxxxxx-XXXX-XXXX-XXXX-xxxxxx"
  sysdig_crn                 = "crn:v1:bluemix:public:sysdig-monitor:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX::"
  activity_tracker_crn       = "crn:v1:bluemix:public:logdnaat:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX::"
}

# Creates additional buckets in existing instance:
module "additional_cos_bucket" {
  source                   = "terraform-ibm-modules/cos/ibm"
  version                  = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
  region                   = "us-south"
  create_cos_instance      = false
  sysdig_crn               = "crn:v1:bluemix:public:sysdig-monitor:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX::"
  activity_tracker_crn     = "crn:v1:bluemix:public:logdnaat:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX::"
  existing_cos_instance_id = module.cos_module.cos_instance_id
  kms_key_crn              = "crn:v1:bluemix:public:kms:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxxxxx-XXXX-XXXX-XXXX-xxxxxx:key:xxxxxx-XXXX-XXXX-XXXX-xxxxxx"
}

# Creates additional Cloud Object Storage buckets using the buckets sub module
module "cos_buckets" {
  source  = "terraform-ibm-modules/cos/ibm//modules/buckets"
  version = "X.X.X" # Replace "X.X.X" with a release version to lock into a specific release
  bucket_configs = [
    {
      bucket_name          = "my-encrypted-bucket"
      kms_key_crn          = "crn:v1:bluemix:public:kms:us-south:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:xxxxxx-XXXX-XXXX-XXXX-xxxxxx:key:xxxxxx-XXXX-XXXX-XXXX-xxxxxx"
      region_location      = "us-south"
      resource_instance_id = module.cos_module.cos_instance_id
    },
    {
      bucket_name            = "my-versioned-bucket"
      kms_encryption_enabled = false
      region_location        = "us-south"
      resource_instance_id   = module.cos_module.cos_instance_id
      object_versioning = {
        enable = true
      }
    },
    {
      bucket_name            = "my-archive-bucket"
      kms_encryption_enabled = false
      region_location        = "us-south"
      resource_instance_id   = module.cos_module.cos_instance_id
      archive_rule = {
        days   = 90
        enable = true
        type   = "Accelerated"
      }
      expire_rule = {
        days   = 90
        enable = true
      }
    }
  ]
}

Required IAM access policies

You need the following permissions to run this module.

  • Account Management
    • Resource Group service
      • Viewer platform access
  • IAM Services
    • IBM Cloud Activity Tracker service
      • Editor platform access
      • Manager service access
    • IBM Cloud Monitoring service
      • Editor platform access
      • Manager service access
    • IBM Cloud Object Storage service
      • Editor platform access
      • Manager service access

Requirements

Name Version
terraform >= 1.4.0, <1.7.0
ibm >= 1.62.0, < 2.0.0
random >= 3.5.1, < 4.0.0
time >= 0.9.1, < 1.0.0

Modules

Name Source Version
bucket_cbr_rule terraform-ibm-modules/cbr/ibm//modules/cbr-rule-module 1.20.1
instance_cbr_rule terraform-ibm-modules/cbr/ibm//modules/cbr-rule-module 1.20.1

Resources

Name Type
ibm_cos_bucket.cos_bucket resource
ibm_cos_bucket.cos_bucket1 resource
ibm_iam_authorization_policy.policy resource
ibm_resource_instance.cos_instance resource
ibm_resource_key.resource_keys resource
ibm_resource_tag.cos_access_tag resource
random_string.bucket_name_suffix resource
time_sleep.wait_for_authorization_policy resource

Inputs

Name Description Type Default Required
access_tags A list of access tags to apply to the cos instance created by the module, see https://cloud.ibm.com/docs/account?topic=account-access-tags-tutorial for more details list(string) [] no
activity_tracker_crn Activity tracker crn for COS bucket (Optional) string null no
add_bucket_name_suffix Add random generated suffix (4 characters long) to the newly provisioned COS bucket name (Optional). bool false no
archive_days Specifies the number of days when the archive rule action takes effect. Only used if 'create_cos_bucket' is true. This must be set to null when when using var.cross_region_location as archive data is not supported with this feature. number 90 no
archive_type Specifies the storage class or archive type to which you want the object to transition. Only used if 'create_cos_bucket' is true. string "Glacier" no
bucket_cbr_rules (Optional, list) List of CBR rules to create for the bucket
list(object({
description = string
account_id = string
rule_contexts = list(object({
attributes = optional(list(object({
name = string
value = string
}))) }))
enforcement_mode = string
tags = optional(list(object({
name = string
value = string
})), [])
operations = optional(list(object({
api_types = list(object({
api_type_id = string
}))
})))
}))
[] no
bucket_name The name to give the newly provisioned COS bucket. Only required if 'create_cos_bucket' is true. string null no
bucket_storage_class the storage class of the newly provisioned COS bucket. Only required if 'create_cos_bucket' is true. Supported values are 'standard', 'vault', 'cold', 'smart' and onerate_active. string "standard" no
cos_instance_name The name to give the cloud object storage instance that will be provisioned by this module. Only required if 'create_cos_instance' is true. string null no
cos_location Location to provision the cloud object storage instance. Only used if 'create_cos_instance' is true. string "global" no
cos_plan Plan to be used for creating cloud object storage instance. Only used if 'create_cos_instance' it true. string "standard" no
cos_tags Optional list of tags to be added to cloud object storage instance. Only used if 'create_cos_instance' it true. list(string) [] no
create_cos_bucket Set as true to create a new Cloud Object Storage bucket bool true no
create_cos_instance Set as true to create a new Cloud Object Storage instance. bool true no
cross_region_location Specify the cross-regional bucket location. Supported values are 'us', 'eu', and 'ap'. If you pass a value for this, ensure to set the value of var.region and var.single_site_location to null. string null no
existing_cos_instance_id The ID of an existing cloud object storage instance. Required if 'var.create_cos_instance' is false. string null no
existing_kms_instance_guid The GUID of the Key Protect or Hyper Protect instance in which the key specified in var.kms_key_crn is coming from. Required if var.skip_iam_authorization_policy is false in order to create an IAM Access Policy to allow Key Protect or Hyper Protect to access the newly created COS instance. string null no
expire_days Specifies the number of days when the expire rule action takes effect. Only used if 'create_cos_bucket' is true. number 365 no
force_delete Deletes all the objects in the COS Bucket before bucket is deleted. bool true no
hard_quota Sets a maximum amount of storage (in bytes) available for a bucket. If it is set to null then quota is disabled. number null no
instance_cbr_rules (Optional, list) List of CBR rules to create for the instance
list(object({
description = string
account_id = string
rule_contexts = list(object({
attributes = optional(list(object({
name = string
value = string
}))) }))
enforcement_mode = string
tags = optional(list(object({
name = string
value = string
})), [])
operations = optional(list(object({
api_types = list(object({
api_type_id = string
}))
})))
}))
[] no
kms_encryption_enabled Set as true to use KMS key encryption to encrypt data in COS bucket (only applicable when var.create_cos_bucket is true). bool true no
kms_key_crn CRN of the KMS key to use to encrypt the data in the COS bucket. Required if var.encryption_enabled and var.create_cos_bucket are true. string null no
management_endpoint_type_for_bucket The type of endpoint for the IBM terraform provider to use to manage the bucket. (public, private or direct) string "public" no
object_versioning_enabled Enable object versioning to keep multiple versions of an object in a bucket. Cannot be used with retention rule. Only used if 'create_cos_bucket' is true. bool false no
region The region to provision the bucket. If you pass a value for this, do not pass one for var.cross_region_location or var.single_site_location. string "us-south" no
resource_group_id The resource group ID where The COS instance will be provisioned. It is required if setting input variable create_cos_instance to true. string null no
resource_keys The definition of any resource keys to be generated
list(object({
name = string
generate_hmac_credentials = optional(bool, false)
role = optional(string, "Reader")
service_id_crn = optional(string, null)
}))
[] no
retention_default Specifies default duration of time an object that can be kept unmodified for COS bucket. Only used if 'create_cos_bucket' is true. number 90 no
retention_enabled Retention enabled for COS bucket. Only used if 'create_cos_bucket' is true. bool false no
retention_maximum Specifies maximum duration of time an object that can be kept unmodified for COS bucket. Only used if 'create_cos_bucket' is true. number 350 no
retention_minimum Specifies minimum duration of time an object must be kept unmodified for COS bucket. Only used if 'create_cos_bucket' is true. number 90 no
retention_permanent Specifies a permanent retention status either enable or disable for COS bucket. Only used if 'create_cos_bucket' is true. bool false no
single_site_location Specify the single site bucket location. If you pass a value for this, ensure to set the value of var.region and var.cross_region_location to null. string null no
skip_iam_authorization_policy Set to true to skip the creation of an IAM authorization policy that permits the COS instance created to read the encryption key from the KMS instance in existing_kms_instance_guid. WARNING: An authorization policy must exist before an encrypted bucket can be created bool false no
sysdig_crn Sysdig Monitoring crn for COS bucket (Optional) string null no

Outputs

Name Description
bucket_cbr_rules COS bucket rules
bucket_crn Bucket CRN
bucket_id Bucket id
bucket_name Bucket name
bucket_region Bucket region if you create a regional bucket
bucket_storage_class Bucket Storage Class
cbr_rule_ids List of all rule ids
cos_instance_crn The CRN of the Cloud Object Storage instance
cos_instance_guid The GUID of the Cloud Object Storage instance
cos_instance_id The ID of the Cloud Object Storage instance
cos_instance_name The name of the Cloud Object Storage instance
instance_cbr_rules COS instance rules
kms_key_crn The CRN of the KMS key used to encrypt the COS bucket
resource_group_id Resource Group ID
resource_keys List of resource keys
s3_endpoint_direct S3 direct endpoint
s3_endpoint_private S3 private endpoint
s3_endpoint_public S3 public endpoint

Contributing

You can report issues and request features for this module in GitHub issues in the module repo. See Report an issue or request a feature.

To set up your local development environment, see Local development setup in the project documentation.

terraform-ibm-cos's People

Contributors

aashiq-j avatar aayush-abhyarthi avatar ak-sky avatar akocbek avatar argeiger avatar daniel-butler-irl avatar dishankkalra23 avatar iamar7 avatar ibmtfprovider avatar jojustin avatar jor2 avatar khuzaima05 avatar kierramarie avatar kprabhatgit avatar maheshwarishikha avatar marifse avatar matthewlemmond avatar mounika-nalla avatar ocofaigh avatar rajatagarwal-ibm avatar shemau avatar sirspidey avatar soaib024 avatar terraform-ibm-modules-ops avatar umarali-nagoor avatar vbontempi avatar vburckhardt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-ibm-cos's Issues

Complete example does not execute when region is set to eu-gb


│ Error: InvalidRequest: The region provided in the KMS key CRN does not provide cross region support.
│ status code: 400, request id: a6d17a58-f715-479e-bb0c-1fe53a149f00, host id:

│ with module.cos_bucket2.ibm_cos_bucket.cos_bucket[0],
│ on ../../main.tf line 77, in resource "ibm_cos_bucket" "cos_bucket":
│ 77: resource "ibm_cos_bucket" "cos_bucket" {

'encyption_enabled' field name is misleading

Minor issue but could lead to confusion.

encryption_enabled controls whether kms encryption is enable (key protect / hpcs). If set to false, cos bucket is still encrypted but with ibm managed keys.

Variable descriptions in COS fscloud submodule need to be updated

The descriptions of the below variable in the FSCloud submodule seem to indicated they are required if 'create_cos_bucket' is true, however there is no create_cos_bucket variable in the FSCloud submodule. They are also not required variables at all (which I think should be correct - the user can optionally opt in).

variable "activity_tracker_crn" {
  type        = string
  description = "Activity tracker crn for COS bucket. Only required if 'create_cos_bucket' is true."
  default     = null
}

variable "sysdig_crn" {
  type        = string
  description = "Sysdig Monitoring crn for COS bucket. Only required if 'create_cos_bucket' is true."
  default     = null
}

buckets submodule is missing the ability to set the endpoint type to use

The root level module has a variable called management_endpoint_type_for_bucket which can be set to "public", "private", or "direct", however there doesn't seem to be any way to set this when creating a bucket using the buckets submodule. That means all buckets get created with "public" since this is the default value in the root level module

Add support for One-rate plan

Description

The variable cos_plan only allows standard and lite plans however it seems there is a third plan - "One Rate":

The One-rate plan offers large enterprises and ISVs (with multiple divisions or end-users) a predictable TCO based on one flat rate. The flat rate has built-in allowances for outbound bandwidth and operational requests. These allowances depend on the amount of storage capacity aggregated across multiple instances within a One Rate pricing region. There is no data retrieval charge.

New or affected modules

https://github.com/terraform-ibm-modules/terraform-ibm-cos


By submitting this issue, you agree to follow our Code of Conduct

Automated test suites for CBR rules

Description

Extracted out from original issue at #201 .

See whether we could expend the automated test suite as well to catch this type of issue - eg: trying to list the cos bucket in the instance as part of the test executing the complete example would catch this type of problem.

Allow naming of cos instance created by terraform-ibm-cos

Description

Most of the time we want to create a Cloud Object Storage instance with a predetermined name that adheres to a projects naming conventions.

The current behaviour when creating a COS instance is to use the name environment-name-cos.

New or affected modules

https://github.com/terraform-ibm-modules/terraform-ibm-cos

Other considerations

Existing consumers of this module that specify both create-cos-instance=true and cos-instance-name may see a change in behaviour. The current behaviour is to silently ignore the cos-instance-name provided. The new behaviour will be to change the name of the COS instance, which may result in an attempt to delete and re-create the instance.

CBR rules are not applied to bucket and instance (incorrect ids passed in the rules)

Scenario to reproduce the issue:

  1. Execute the complete examples at https://github.com/terraform-ibm-modules/terraform-ibm-cos/tree/main/examples/complete - this example creates 3 CBR rules (one for instance, and one per bucket) that are scoped to allow access only from a VPC (created in the example as well)
  2. Change the CBR enforcement mode to 'enabled' (example set it to reporting by default)
  3. Navigate to the COS instance from your local browser (so that you're not in the VPC..) - from the IBM cloud console for instance.

Result: Notice you can see the instance and buckets
Expected: Access denied message when accessing the instance as requests are not coming from within VPC (but the internet in this case). As below (displayed when fixing the CBR rule manually)

image

Issue is that the module pass the instance id as input, instead of the guid. https://github.com/terraform-ibm-modules/terraform-ibm-cos/blob/main/main.tf#L236

Affected modules

  • terraform-ibm-cos
  • Seeing the same problem across all modules using the same CBR code - so it would be good to do a sweep around

See whether we could expend the automated test suite as well to catch this type of issue - eg: trying to list the cos bucket in the instance as part of the test executing the complete example would catch this type of problem.

Add support to COS module to create IAM based resource key

The COS module should support creating IAM as well as HMAC resource keys. Currently it only supports HMAC keys however IAM API Keys are the preferred method of authentication for COS as per docs.

Proposal:

Rename these variables (both root level module and fscloud submodule)

  • create_hmac_key -> create_resource_key
  • hmac_key_name -> resource_key_name
  • hmac_key_role -> resource_key_role

Create a new boolean variable called generate-hmac-credentials which should be used like this:

parameters = {
    "serviceid_crn" = var.resource_key_existing_serviceid_crn
    "HMAC"          = var.generate-hmac-credentials
  }

Since IAM is the recommended key type, I think we should set generate-hmac-credentials to false by default (make sure we mention this in the release notes, as it will attempt to destroy any existing hmac credentials and replace it with an IAM credential)

Expose COS resource key details as outputs

The COS module supports creating a resource key, however it does not output it in its outputs.
We should add 3 new outputs to output the name, ID and value of the key.

The problem we will face is when we output the key value as a sensitive value, the buckets module complains because it has the following output:

output "buckets" {
  description = "Map of buckets created in the Cloud Object Storage Instance"
  value       = module.buckets
}

The output will now contain a sensitive value and hence terraform says it should be marked as a sensitive, which is not what we want. We should update the logic here so it only outputs bucket info. There is no need to include the resource key output in this output.

Ensure we also add the outputs to the fscloud submodule.

Create a simple basic example for the module

Description

All example and the usage section go into a lot of complexity in term of replication, encryption, etc.

It would be desirable to have a simple, basic example that creates an instance with a bucket with the minimum amount of inputs to set.

Authorization COS - KMS malformed

Hello there,

We are facing an issue with your module, especially regarding authorization as shown below:

 ibm_resource_instance.kms_instance: Creating...
 2023/01/27 22:03:52 Terraform apply | module.cos.ibm_resource_instance.cos_instance[0]: Creating...
 2023/01/27 22:04:02 Terraform apply | ibm_resource_instance.kms_instance: Still creating... [10s elapsed]
 2023/01/27 22:04:02 Terraform apply | module.cos.ibm_resource_instance.cos_instance[0]: Still creating... [10s elapsed]
 2023/01/27 22:04:06 Terraform apply | ibm_resource_instance.kms_instance: Creation complete after 14s [id=crn:v1:bluemix:public:kms:eu-fr2:a/3f2cae45b0644f6d87aefcf404f5987f:ba24f111-f80e-4298-a301-ca20371a0d8d::]
 2023/01/27 22:04:06 Terraform apply | data.ibm_kms_keys.encryption_data: Reading...
 2023/01/27 22:04:06 Terraform apply | ibm_kms_key.encryption_key: Creating...
 2023/01/27 22:04:07 Terraform apply | data.ibm_kms_keys.encryption_data: Read complete after 0s [id=ba24f111-f80e-4298-a301-ca20371a0d8d]
 2023/01/27 22:04:07 Terraform apply | ibm_kms_key.encryption_key: Creation complete after 1s [id=crn:v1:bluemix:public:kms:eu-fr2:a/3f2cae45b0644f6d87aefcf404f5987f:ba24f111-f80e-4298-a301-ca20371a0d8d:key:8c87060a-6993-47b5-9ca6-1e2738973927]
 2023/01/27 22:04:08 Terraform apply | module.cos.ibm_resource_instance.cos_instance[0]: Creation complete after 16s [id=crn:v1:bluemix:public:cloud-object-storage:global:a/3f2cae45b0644f6d87aefcf404f5987f:d20bf547-6b85-4f4b-877c-1475c4bde1ee::]
 2023/01/27 22:04:08 Terraform apply | module.cos.ibm_resource_key.resource_key[0]: Creating...
 2023/01/27 22:04:08 Terraform apply | module.cos.ibm_iam_authorization_policy.policy[0]: Creating...
 2023/01/27 22:04:09 Terraform apply | module.cos.ibm_iam_authorization_policy.policy[0]: Creation complete after 1s [id=a77acd3f-d3c4-4c63-b1b5-0951bfee108d]
 2023/01/27 22:04:09 Terraform apply | module.cos.ibm_cos_bucket.cos_bucket[0]: Creating...
 2023/01/27 22:04:12 Terraform apply | module.cos.ibm_resource_key.resource_key[0]: Creation complete after 4s [id=crn:v1:bluemix:public:cloud-object-storage:global:a/3f2cae45b0644f6d87aefcf404f5987f:d20bf547-6b85-4f4b-877c-1475c4bde1ee:resource-key:3c34a882-8178-4ab8-b136-c010847e62b5]
 2023/01/27 22:04:12 Terraform apply | 
 2023/01/27 22:04:12 Terraform apply | Error: ServiceNotAuthorized: The specified COS Service Instance does not have sufficient permissions to access the resource associated with the KMS key CRN.
 2023/01/27 22:04:12 Terraform apply | 	status code: 401, request id: d32b07a0-e350-4e6a-aa86-787e467c0b4f, host id: 
 2023/01/27 22:04:12 Terraform apply | 
 2023/01/27 22:04:12 Terraform apply |   with module.cos.ibm_cos_bucket.cos_bucket[0],
 2023/01/27 22:04:12 Terraform apply |   on .terraform/modules/cos/main.tf line 76, in resource "ibm_cos_bucket" "cos_bucket":
 2023/01/27 22:04:12 Terraform apply |   76: resource "ibm_cos_bucket" "cos_bucket" {
 2023/01/27 22:04:12 Terraform apply | 
 2023/01/27 22:04:12 �[1m�[31mTerraform APPLY error: Terraform APPLY errorexit status 1�[39m�[0m

We found out that your authorization resource input for the source_service_id, is not correct, it should be the GUID of the COS instance instead of ID.

It results into this authorization in your IAM:

image

###Proposal

locals {
 cos_instance_id      = var.create_cos_instance == true ? tolist(ibm_resource_instance.cos_instance[*].id)[0] : var.existing_cos_instance_id
 cos_instance_guid      = var.create_cos_instance == true ? : tolist(ibm_resource_instance.cos_instance[*].guid)[0] : element(split(":",var.existing_cos_instance_id),length(split(":",var.existing_cos_instance_id)-3)
 create_access_policy = var.encryption_enabled && var.create_cos_instance
}

# Create IAM Access Policy to allow Key protect to access COS instance
resource "ibm_iam_authorization_policy" "policy" {
 count                       = local.create_access_policy ? 1 : 0
 source_service_name         = "cloud-object-storage"
 source_resource_instance_id = local.cos_instance_guid
 target_service_name         = "kms"
 target_resource_instance_id = var.existing_key_protect_instance_guid
 roles                       = ["Reader"]
}

Resulting into a correct Authorization:
image

Let me know if you want me to do a PR.

Regards

Timing issue with auth policy when creating multiple buckets with buckets submodule

When you are using the buckets or fscloud submodule, and you are creating more than 1 bucket with KMS encryption enabled, and have skip_iam_authorization_policy set to false for 1 bucket and set to true for the other, there is a timing issue where 1 bucket config will start to create the KMS auth policy first, while the other will start to create the bucket first, but bucket creation will fail because the auth policy may not yet be created.

We found this issue in terraform-ibm-modules/terraform-ibm-observability-da#8

Ideally we need to find a way where if any bucket config is set to create an auth policy, NO buckets should get created until its created. This logic would have to live in the buckets submodule I guess.

We probably should also fast fail if we detect that multiple buckets have skip_iam_authorization_policy set to false since its going to try and create duplicate policies and fail anyway.

Cannot create COS instance only with skip_iam_authorization_policy=false in v6.0.0

Affected modules

  • COS

Terraform CLI and Terraform provider versions

  • Terraform version: v1.4.5
  • Provider version: v1.51.0

Expected behavior

As a user I should be able to create a COS instance only without buckets and associate it to a KMS instance.

The ibm_iam_authorization_policy to authorize COS instance to read KMS keys should not be skipped.

I need something similar to this:
module "cos_instance" {
source = "../../"
cos_instance_name = "${var.prefix}-cos"
create_cos_bucket = false
resource_group_id = module.resource_group.resource_group_id
existing_kms_instance_guid = module.key_protect_all_inclusive.key_protect_guid
region = var.region
cross_region_location = null
activity_tracker_crn = null
resource_key_existing_serviceid_crn = ibm_iam_service_id.resource_key_existing_serviceid.crn
skip_iam_authorization_policy = false
}

Actual behavior

I get the following error:
Error: Invalid combination of arguments

with module.cos_module["vpc-cos"].ibm_iam_authorization_policy.policy[0],
on .terraform/modules/cos_module/main.tf line 73, in resource "ibm_iam_authorization_policy" "policy":
73: target_service_name = local.kms_service

"target_service_name": one of resource_attributes,target_service_name must be specified

Steps to reproduce (including links and screen captures)

By submitting this issue, you agree to follow our Code of Conduct

Double check that access tags are indeed evaluated in the CBR rules

Description

There is a need to have an actual check that the tags passed in the CBR rule are indeed used. So far, I think the assumption is that they are, but I don't think this has been actually verified. Perhaps, as part of this add a tag example here: https://github.com/terraform-ibm-modules/terraform-ibm-cos/tree/main/examples

New or affected modules


By submitting this issue, you agree to follow our Code of Conduct

Review COS DA diagrams

Review the diagram(s) in the reference-architectures directory...

  • Do they contain accurate relevant information
  • Are they using approved icons / objects?

Don't output the bucket name until bucket is created

Can we have the module only output the bucket name once the bucket is actually created and ready for use? That way consuming modules won't have to add explicit depends_on in their code since they always take bucket name is as input as opposed to bucket ID.

To do this, we can add a depends_on in the outout:

output "bucket_name" {
  description = "Bucket name"
  value       = local.bucket_name
  depends_on  = [local.bucket_id]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.