-
Notifications
You must be signed in to change notification settings - Fork 671
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
Add support for lockdowns in CIS resource #1201
Comments
Can you provide me some links to understand this feature and can you also provider us the null resource/bash script |
Yep for sure. Here is the IBM documentation: https://cloud.ibm.com/docs/cis?topic=cis-how-cis-keeps-your-work-secure Here is a snippet we have made: resource "local_file" "lockdown" {
content = jsonencode(local.lockdown_payload)
filename = "${path.module}/lockdown.json"
}
resource "null_resource" "ip_filtering_lockdown" {
depends_on = [local_file.lockdown]
triggers = {
build_number = "${timestamp()}"
}
provisioner "local-exec" {
command = <<EOT
ibmcloud login -r ${var.region} -g ${var.resource_group_id}
existing_rules=$(ibmcloud cis firewalls -t lockdowns -i ${var.cis_id} -d ${element(split(":", var.domain_id), 0)} --output json)
for row in $(echo "$existing_rules" | jq -r '.[] | @base64'); do
_jq() {
echo $row | base64 -d | jq -r $1
}
if [ $(_jq '.urls[0]') == ${local.full_domain} ];then
ibmcloud cis firewall-delete $(_jq '.id') -t lockdowns -d ${element(split(":", var.domain_id), 0)} -i ${var.cis_id}
fi
done
ibmcloud cis firewall-create -t lockdowns -d ${element(split(":", var.domain_id), 0)} -i ${var.cis_id} -j "${path.module}/lockdown.json"
EOT
}
} |
We would like to achieve the CRUD actions on cis_lockdown ! |
@hkantare seeing a lot of commit :) :) When can we expect this feature to be released ? |
@hkantare we definetly need the documentation ! |
Docs will be update in couple of days....I'm rasining request against doc team |
@hkantare while waiting for the doc, can you give an example of using ibm_cis_firewall with lockdown param please |
@hkantare & @kavya498 thanks for the update. There is something that lead us to some 404 errors which is the inconsistency of usage of the IDs syntax, in all your documentation that refers to In that case:
But in fact, the syntax of the expected ID is not the same.
I would suggest, since IBM Cloud has multiple IDs syntax for resource, to provide a more accurated information/examples to the end-user. I will close this issue after you see my message and suggest an enhancement. |
We will make changes to be inline with other CIS resources..as enhancement |
Is it possible to have non-regression that you both support those two types of syntax ? @hkantare |
I will create another case for this domain_id inconsistency between TF resources/datasources and the CLI. |
We will have inconsistency issues if we support both types...because we need to set back all the schema attributes to store in a statefile...If we support both types we will not be aware if user has passed which type ... |
Hi there,
We would like to be able to manage CIS lockdowns rules through Terraform instead of using null_resource and bash scripts.
Thanks in advance
The text was updated successfully, but these errors were encountered: