Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunchauhanibm committed Dec 15, 2024
1 parent 4468958 commit 361eac1
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 43 deletions.
15 changes: 8 additions & 7 deletions examples/ibm-cis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,14 @@ resource "ibm_cis_logpush_job" "test" {

# COS
resource "ibm_cis_logpush_job" "test" {
cis_id = "crn:v1:staging:public:internet-svcs-ci:global:a/01652b251c3ae2787110a995d8db0135:1a9174b6-0106-417a-844b-c8eb43a72f63::"
domain_id = "601b728b86e630c744c81740f72570c3"
name = "MylogpushJob"
enabled = false
logpull_options = "timestamps=rfc3339&timestamps=rfc3339"
dataset = "http_requests"
frequency = "high"
cis_id = "crn:v1:staging:public:internet-svcs-ci:global:a/01652b251c3ae2787110a995d8db0135:1a9174b6-0106-417a-844b-c8eb43a72f63::"
domain_id = "601b728b86e630c744c81740f72570c3"
name = "MylogpushJob"
enabled = false
logpull_options = "timestamps=rfc3339&timestamps=rfc3339"
dataset = "http_requests"
frequency = "high"
ownership_challenge = "xxx"
cos =<<COS
{
"bucket_name": "examplse.cistest-load.com",
Expand Down
27 changes: 16 additions & 11 deletions website/docs/d/cis_logpush_jobs.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,33 @@ Retrieve information about an IBM Cloud Internet Services logpush jobs data sour

```terraform
data "ibm_cis_logpush_jobs" "tests" {
cis_id = data.ibm_cis.cis.id
domain_id = data.ibm_cis_domain.cis_domain.domain_id
cis_id = data.ibm_cis.cis.id
domain_id = data.ibm_cis_domain.cis_domain.domain_id
job_id = data.ibm_cis_domain.logpush_job.job_id
}
```

## Argument reference

Review the argument references that you can specify for your data source.

- `cis_id` - (Required, String) The ID of the CIS service instance.
- `domain_id` - (Required, String) The Domain ID of the CIS service instance.

- `job_id` - (Optional, String) Logpush Job ID. If job_id is not provided you will get the list of jobs. If job_id is provided you will get the information of the particular job.

## Attributes reference

In addition to all argument reference list, you can access the following attribute references after your data source is created.

- `id` - (String) The Logpush Job ID. It is a combination of <`job_id`>,<`cis_id`> attributes concatenated with ":"
- `logpush_job_pack` - (List)
- `job_id` - (String) The Logpush job ID.
- `name` - (String) The name of Logpush job.
- `enabled` - (Bool) Whether the logpush job enabled or not.
- `logpull_options` - (String) Configuration string for Logpush Job.
- `destination_conf` - (String) Uniquely identifies a resource (such as an s3 bucket) where data will be pushed.
- `dataset` - (String) Dataset to be pulled for Logpush Job and the values are `http_requests`, `range_events`, `firewall_events`.
- `frequency` - (String) The frequency at which CIS sends batches of logs to your destination, `high`, `low`.

- `job_id` - (String) The Logpush job ID.
- `name` - (String) The name of Logpush job.
- `enabled` - (Bool) Whether the logpush job enabled or not.
- `logpull_options` - (String) Configuration string for Logpush Job.
- `destination_conf` - (String) Uniquely identifies a resource (such as an s3 bucket) where data will be pushed.
- `dataset` - (String) Dataset to be pulled for Logpush Job and the values are `http_requests`, `range_events`, `firewall_events`.
- `frequency` - (String) The frequency at which CIS sends batches of logs to your destination, `high`, `low`.
- `last_complete` - (String) Records the last time for which logs have been successfully pushed.
- `last_error` - (String) Records the last time the job failed.
- `error_message` - (String) The last failure.
119 changes: 94 additions & 25 deletions website/docs/r/cis_logpush_jobs.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,80 @@ Retrieve information about an IBM Cloud Internet Services logpush jobs data sour
## Example usage

```terraform
# LOG DNA example
resource "ibm_cis_logpush_job" "test" {
cis_id = data.ibm_cis.cis.id
domain_id = data.ibm_cis_domain.cis_domain.domain_id
name = "MylogpushJob"
enabled = false
logpull_options = "timestamps=rfc3339&timestamps=rfc3339"
dataset = "http_requests"
frequency = "low"
logdna =<<LOG
{
"hostname": "examplse.cistest-load.com",
"ingress_key": "e2f72cxxxxxxxxxxxxa0b87859e",
"region": "in-che"
}
LOG
}
cis_id = data.ibm_cis.cis.id
domain_id = data.ibm_cis_domain.cis_domain.domain_id
name = "MylogpushJob"
enabled = false
logpull_options = "timestamps=rfc3339&timestamps=rfc3339"
dataset = "http_requests"
frequency = "low"
logdna =<<LOG
{
"hostname": "examplse.cistest-load.com",
"ingress_key": "e2f72cxxxxxxxxxxxxa0b87859e",
"region": "in-che"
}
LOG
}
```

```terraform
# COS example
resource "ibm_cis_logpush_job" "test" {
cis_id = data.ibm_cis.cis.id
domain_id = data.ibm_cis_domain.cis_domain.domain_id
name = "MylogpushJob"
enabled = false
logpull_options = "timestamps=rfc3339&timestamps=rfc3339"
dataset = "http_requests"
frequency = "low"
ownership_challenge = "xxxxxxxxx"
cos =<<COS
{
"bucket_name" = "examplse.cistest-load.com",
"id" = "12bcxxxxxxxxxxxxa0b842f",
"region" = "in-che"
}
COS
}
```

```terraform
# ibmcl example
resource "ibm_cis_logpush_job" "test" {
cis_id = data.ibm_cis.cis.id
domain_id = data.ibm_cis_domain.cis_domain.domain_id
name = "MylogpushJob"
enabled = false
logpull_options = "timestamps=rfc3339&timestamps=rfc3339"
dataset = "http_requests"
frequency = "low"
ibmcl {
instance_id = "604a309c-585c-4a42-955d-76239ccc1905"
api_key = "zxzeNQI22dPwNVCcmS62YFL1tm9vaehY6C9jxdtn1EVK"
region = "us-south"
}
}
```

```terraform
# general example
resource "ibm_cis_logpush_job" "test" {
cis_id = data.ibm_cis.cis.id
domain_id = data.ibm_cis_domain.cis_domain.domain_id
name = "MylogpushJob"
enabled = false
logpull_options = "timestamps=rfc3339&timestamps=rfc3339"
dataset = "http_requests"
frequency = "low"
destination_conf = "s3://mybucket/logs?region=us-west-2"
}
```

## Argument reference

Review the argument references that you can specify for your resource.

- `cis_id` - (Required, String) The ID of the CIS service instance.
Expand All @@ -41,15 +96,30 @@ Review the argument references that you can specify for your resource.
- `logpull_options` - (Required, String) Configuration string.
- `dataset` - (Optional, String) Dataset to be pulled,Option for dataset`http_requests`,`range_events`,`firewall_events`
- `frequency` - (Optional, String) The frequency at which CIS sends batches of logs to your destination.`high`, `low`
- `logdna` - (Required, String)Information to identify the LogDNA instance the data will be pushed. Must provided in JSON format. Which need hostename,ingress_key and region (https://cloud.ibm.com/docs/cis?topic=cis-logpush&interface=api)
- `logdna` - (Optional, String) Information to identify the LogDNA instance the data will be pushed. Must provided in JSON format. Which need hostname,ingress_key and region (<https://cloud.ibm.com/docs/cis?topic=cis-logpush&interface=api>)
- `cos` - (Optional, String) Information to identify the COS bucket where the data will be pushed. Must provided in JSON format. Which need bucket_name,id and region.
- `ownership_challenge` - (Optional, String) Ownership challenge token to prove destination ownership. `cos` and `ownership_challenge` has to be used together.
- `ibmcl` - (Optional, Map)

Nested scheme of `ibmcl`:
- `instance_id` - (Required, String) ID of the IBM Cloud Logs instance where you want to send logs.
- `region` (Required, String) Region where the IBM Cloud Logs instance is located.
- `api_key` (Required, String) IBM Cloud API key used to generate a token for pushing to your Cloud Logs instance
- `destination_conf` (Optional, String) Uniquely identifies a resource where data will be pushed. Additional configuration parameters supported by the destination may be included.

### Note

Exactly one of the attribute must be used. `logdna`, `cos`, `ibmcl` and `destination_conf`.

## Attributes Reference

In addition to all argument reference list, you can access the following attribute reference after your resource is created.

- `id` - (String) The ID of logpush job resource. It is a combination of <`job-id`>:<`crn`> attributes concatenated with ":".
- `job_id` - (String) Unique identifier for the each LogpushJob.

- `last_complete` - (String) Records the last time for which logs have been successfully pushed.
- `last_error` - (String) Records the last time the job failed.
- `error_message` - (String) The last failure.

## Import

Expand All @@ -59,17 +129,16 @@ The CRN will be located on the **Overview** page of the Internet Services instan

- **CRN** is a 120 digit character string of the form: `crn:v1:bluemix:public:internet-svcs:global:a/4ea1882a2d3401ed1e459979941966ea:31fa970d-51d0-4b05-893e-251cba75a7b3::`

- **Job ID** is a 32 digit character string of the form: `52bfa670237f49ecb68473033c569649`.
- **Job ID** is a 4-8 digit string of the form: `34524`.

**Syntax**
## Syntax

```
$ terraform import ibm_cis_logpus_jobs.myorg <job_id>:<crn>
```terraform
terraform import ibm_cis_logpus_jobs.myorg <job_id>:<crn>
```

**Example**
## Example

```
$ terraform import ibm_cis_logpus_jobs.myorg
crn:v1:bluemix:public:internet-svcs-ci:global:a/01652b251c3ae2787110a995d8db0135:9054ad06-3485-421a-9300-fe3fb4b79e1d::
```terraform
terraform import ibm_cis_logpus_jobs.myorg 23424:crn:v1:bluemix:public:internet-svcs-ci:global:a/01652b251c3ae2787110a995d8db0135:9054ad06-3485-421a-9300-fe3fb4b79e1d::
```

0 comments on commit 361eac1

Please sign in to comment.