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

add resource dms_kafka_instance #1162

Merged
merged 1 commit into from
May 26, 2021

Conversation

Jason-Zhang9309
Copy link
Collaborator

What this PR does / why we need it:

add resource dms_kafka_instance

Which issue this PR fixes:
(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)
related #1052

Special notes for your reviewer:

Release note:


PR Checklist

  • Tests added/passed.
  • Documentation updated.
  • Schema updated.

Acceptance Steps Performed

make testacc TEST='./huaweicloud' TESTARGS='-run TestAccDmsKafkaInstances'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./huaweicloud -v -run TestAccDmsKafkaInstances -timeout 360m -parallel 4
=== RUN   TestAccDmsKafkaInstances_basic
=== PAUSE TestAccDmsKafkaInstances_basic
=== RUN   TestAccDmsKafkaInstances_withEpsId
=== PAUSE TestAccDmsKafkaInstances_withEpsId
=== CONT  TestAccDmsKafkaInstances_basic
=== CONT  TestAccDmsKafkaInstances_withEpsId
--- PASS: TestAccDmsKafkaInstances_withEpsId (463.21s)
--- PASS: TestAccDmsKafkaInstances_basic (484.29s)
PASS
ok      github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud       484.337s

docs/resources/dms_kafka_instance.md Outdated Show resolved Hide resolved

* `product_id` - (Required, String, ForceNew) Specifies a product ID. Changing this creates a new instance resource.

* `kafka_manager_user` - (Required, String, ForceNew) Specifies the username for logging in to the Kafka Manager.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest to rename it to manager_user

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

- `time_base`: Automatically delete the earliest messages.
- `produce_reject`: Stop producing new messages.

* `connector_enable` - (Optional, Bool, ForceNew) Specifies whether to enable dumping.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest rename it to dumping to keep with the console

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 170 to 171
- `true`: enable
- `false`: disable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can set the value to true of false for a bool type, so the two lines are redundant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


Changing this creates a new instance resource.

* `partition_num` - (Required, Int, ForceNew) Specifies the maximum number of topics in the DMS kafka instance.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the value depends on specification, we can use it as an internal parameter or set it as an attribute

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Computed: true,
ForceNew: true,
},
"storage_spec_code": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put the required field in the head of the schema

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 195 to 196
* `user_id` - Indicates a user ID.
* `user_name` - Indicates a username.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tenant user id or the kafka user id?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

specification := d.Get("specification").(string)
publicIpIDsRaw := d.Get("public_ip_ids").([]interface{})

if specification == "100MB" && len(publicIpIDsRaw) != 3 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using a map will be more clearer

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@Jason-Zhang9309
Copy link
Collaborator Author

latest test result:

make testacc TEST='./huaweicloud' TESTARGS='-run TestAccDmsKafkaInstances'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./huaweicloud -v -run TestAccDmsKafkaInstances -timeout 360m -parallel 4
=== RUN   TestAccDmsKafkaInstances_basic
=== PAUSE TestAccDmsKafkaInstances_basic
=== RUN   TestAccDmsKafkaInstances_withEpsId
=== PAUSE TestAccDmsKafkaInstances_withEpsId
=== CONT  TestAccDmsKafkaInstances_basic
=== CONT  TestAccDmsKafkaInstances_withEpsId
--- PASS: TestAccDmsKafkaInstances_withEpsId (749.50s)
--- PASS: TestAccDmsKafkaInstances_basic (770.96s)
PASS
ok      github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud       771.017s

@ShiChangkuo ShiChangkuo merged commit 95acf25 into huaweicloud:master May 26, 2021
@Jason-Zhang9309 Jason-Zhang9309 deleted the dev-dms-kafka branch May 28, 2021 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants