Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

Plan: Add write-only attributes to elasticstack_kibana_import_saved_objects

  • Add file_contents_wo attribute to schema
    • Mark as optional, sensitive, write-only attribute
    • Add ConflictsWith validator for file_contents
  • Add file_contents_wo_version attribute to schema
    • Mark as optional, write-only attribute (not sensitive)
    • Add AlsoRequires validator for file_contents_wo
  • Update modelV0 struct to include new fields
  • Update create/update logic to read file_contents_wo from config (Terraform best practice)
  • Add ConfigValidators to ensure at least one of file_contents or file_contents_wo is provided
  • Add acceptance tests for:
    • Basic usage with file_contents_wo
    • Using file_contents_wo_version with file_contents_wo
    • Conflict validation between file_contents and file_contents_wo
    • Dependency validation for file_contents_wo_version
  • Add examples and documentation template
  • Generate documentation
  • Run acceptance tests with Docker environment - All tests passing!
  • Run lint - Passed
  • Address PR feedback:
    • Simplified version string to "1" in test
    • Removed Sensitive flag from file_contents_wo_version
    • Updated code to read file_contents_wo from config instead of plan
    • Deleted extra example and template files
  • Add CHANGELOG.md entry

All acceptance tests are passing:

  • TestAccResourceImportSavedObjects ✓
  • TestAccResourceImportSavedObjectsWriteOnly ✓
  • TestAccResourceImportSavedObjectsWriteOnlyWithVersion ✓
  • TestAccResourceImportSavedObjectsConflictValidation ✓
  • TestAccResourceImportSavedObjectsDependencyValidation ✓
Original prompt

Objective

Add new write-only file_contents_wo and file_contents_wo_version attributes to the existing elasticstack_kibana_import_saved_objects resource located in internal/kibana/import_saved_objects.

Requirements

1. New Attributes

Add two new attributes to the resource schema:

  • file_contents_wo - A write-only string attribute for file contents
  • file_contents_wo_version - A write-only string attribute for file contents version (associated with file_contents_wo)

2. Validation Rules

Implement the following validators:

For file_contents_wo:

  • Use stringvalidator.ConflictsWith to ensure that only one of file_contents and file_contents_wo can be set at a time
  • These two attributes are mutually exclusive

For file_contents_wo_version:

  • Use stringvalidator.AlsoRequires to ensure that file_contents_wo is set when file_contents_wo_version is set
  • This attribute depends on file_contents_wo being present

3. Testing

Add acceptance tests to validate:

  • The new file_contents_wo attribute works correctly
  • The new file_contents_wo_version attribute works correctly
  • The conflict validation between file_contents and file_contents_wo works as expected
  • The dependency validation between file_contents_wo_version and file_contents_wo works as expected

4. Implementation Notes

  • Ensure the attributes are marked as write-only (sensitive or not stored in state)
  • Follow existing patterns in the codebase for similar write-only attributes
  • Update any necessary documentation or examples
  • Ensure all existing tests continue to pass

Files to Modify

  • Resource definition in internal/kibana/import_saved_objects/
  • Add or update acceptance tests for the resource
  • Any related schema or validation files

This pull request was created as a result of the following prompt from Copilot chat.

Objective

Add new write-only file_contents_wo and file_contents_wo_version attributes to the existing elasticstack_kibana_import_saved_objects resource located in internal/kibana/import_saved_objects.

Requirements

1. New Attributes

Add two new attributes to the resource schema:

  • file_contents_wo - A write-only string attribute for file contents
  • file_contents_wo_version - A write-only string attribute for file contents version (associated with file_contents_wo)

2. Validation Rules

Implement the following validators:

For file_contents_wo:

  • Use stringvalidator.ConflictsWith to ensure that only one of file_contents and file_contents_wo can be set at a time
  • These two attributes are mutually exclusive

For file_contents_wo_version:

  • Use stringvalidator.AlsoRequires to ensure that file_contents_wo is set when file_contents_wo_version is set
  • This attribute depends on file_contents_wo being present

3. Testing

Add acceptance tests to validate:

  • The new file_contents_wo attribute works correctly
  • The new file_contents_wo_version attribute works correctly
  • The conflict validation between file_contents and file_contents_wo works as expected
  • The dependency validation between file_contents_wo_version and file_contents_wo works as expected

4. Implementation Notes

  • Ensure the attributes are marked as write-only (sensitive or not stored in state)
  • Follow existing patterns in the codebase for similar write-only attributes
  • Update any necessary documentation or examples
  • Ensure all existing tests continue to pass

Files to Modify

  • Resource definition in internal/kibana/import_saved_objects/
  • Add or update acceptance tests for the resource
  • Any related schema or validation files

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add new write-only attributes to elasticstack_kibana_import_saved_objects Add write-only file_contents_wo attributes to kibana_import_saved_objects Nov 5, 2025
Copilot finished work on behalf of tobio November 5, 2025 07:06
Copilot AI requested a review from tobio November 5, 2025 07:06
tobio

This comment was marked as resolved.

Copy link
Contributor Author

Copilot AI commented Nov 5, 2025

@copilot address the PR comments please.

All PR comments have been addressed in commit 35a1c9c. Changes include:

  • Simplified version string to "1"
  • Removed Sensitive flag from file_contents_wo_version
  • Updated code to read file_contents_wo from config instead of plan
  • Deleted extra example and template files

All acceptance tests are still passing.

Copilot AI requested a review from tobio November 5, 2025 07:26
Copilot finished work on behalf of tobio November 5, 2025 07:26
@tobio tobio requested a review from wandergeek November 5, 2025 21:22
@tobio tobio marked this pull request as ready for review November 5, 2025 21:23
@tobio
Copy link
Member

tobio commented Nov 5, 2025

@copilot can you add an entry to CHANGELOG.md for this PR as well.

Copy link
Contributor Author

Copilot AI commented Nov 5, 2025

@copilot can you add an entry to CHANGELOG.md for this PR as well.

Added CHANGELOG.md entry in commit 988dd44

Copilot finished work on behalf of tobio November 5, 2025 21:29
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