diff --git a/changelog/29633.txt b/changelog/29633.txt
new file mode 100644
index 0000000000..9df7a4b970
--- /dev/null
+++ b/changelog/29633.txt
@@ -0,0 +1,3 @@
+```release-note:bug
+ui/database: Added input field for setting 'skip_import_rotation' when creating a static role
+```
diff --git a/ui/app/models/database/role.js b/ui/app/models/database/role.js
index 79f6fbd727..4c75e99601 100644
--- a/ui/app/models/database/role.js
+++ b/ui/app/models/database/role.js
@@ -54,6 +54,12 @@ export default Model.extend({
'Specifies the amount of time Vault should wait before rotating the password. The minimum is 5 seconds. Default is 24 hours.',
helperTextEnabled: 'Vault will rotate password after',
}),
+ skip_import_rotation: attr({
+ label: 'Skip initial rotation',
+ editType: 'boolean',
+ defaultValue: false,
+ subText: 'When unchecked, Vault automatically rotates the password upon creation',
+ }),
creation_statements: attr('array', {
editType: 'stringArray',
}),
@@ -110,6 +116,7 @@ export default Model.extend({
'max_ttl',
'username',
'rotation_period',
+ 'skip_import_rotation',
'creation_statements',
'creation_statement', // for editType: JSON
'revocation_statements',
diff --git a/ui/app/utils/model-helpers/database-helpers.js b/ui/app/utils/model-helpers/database-helpers.js
index d669e36178..085fc8626b 100644
--- a/ui/app/utils/model-helpers/database-helpers.js
+++ b/ui/app/utils/model-helpers/database-helpers.js
@@ -188,7 +188,7 @@ export const AVAILABLE_PLUGIN_TYPES = [
];
export const ROLE_FIELDS = {
- static: ['username', 'rotation_period'],
+ static: ['username', 'rotation_period', 'skip_import_rotation'],
dynamic: ['default_ttl', 'max_ttl'],
};
diff --git a/ui/tests/integration/components/database-role-edit-test.js b/ui/tests/integration/components/database-role-edit-test.js
index 113bd818bc..a9ce5aa926 100644
--- a/ui/tests/integration/components/database-role-edit-test.js
+++ b/ui/tests/integration/components/database-role-edit-test.js
@@ -22,6 +22,7 @@ module('Integration | Component | database-role-edit', function (hooks) {
database: ['my-mongodb-database'],
backend: 'database',
username: 'staticTestUser',
+ skip_import_rotation: false,
type: 'static',
name: 'my-static-role',
id: 'my-static-role',
@@ -58,6 +59,31 @@ module('Integration | Component | database-role-edit', function (hooks) {
await click('[data-test-secret-save]');
});
+ test('it should successfully create user with skip import rotation', async function (assert) {
+ this.server.post('/sys/capabilities-self', capabilitiesStub('database/static-creds/my-role', ['create']));
+ this.server.post(`/database/static-roles/my-static-role`, (schema, req) => {
+ assert.true(true, 'request made to create static role');
+ assert.propEqual(
+ JSON.parse(req.requestBody),
+ {
+ path: 'static-roles',
+ username: 'staticTestUser',
+ rotation_period: '172800s', // 2 days in seconds
+ skip_import_rotation: true,
+ },
+ 'it creates a static role with correct payload'
+ );
+ });
+
+ await render(hbs``);
+ await fillIn('[data-test-ttl-value="Rotation period"]', '2');
+ await click('[data-test-input="skip_import_rotation"]');
+ await click('[data-test-secret-save]');
+
+ await render(hbs``);
+ assert.dom('[data-test-value-div="Skip initial rotation"]').containsText('Yes');
+ });
+
test('it should show Get credentials button when a user has the correct policy', async function (assert) {
this.server.post('/sys/capabilities-self', capabilitiesStub('database/static-creds/my-role', ['read']));
await render(hbs``);