diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref index 4f16cd6a9..ed3e5f228 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-87_load_balancer_listener_rule_datasource_attributes_ok/step1.load_balancer_listener_rule_datasource_attributes_ok.ref @@ -355,4 +355,4 @@ } ], "check_results": "########" -} \ No newline at end of file +} diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref index a576438ab..0e3115c1c 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step1.load_balancer_listener_rule_resource_attributes_ok.ref @@ -371,4 +371,4 @@ } ], "check_results": "########" -} \ No newline at end of file +} diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref index f2f61d073..c11bf09c8 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rule/TF-88_load_balancer_listener_rule_resource_attributes_ok/step2.load_balancer_listener_rule_resource_attributes_ok.ref @@ -239,7 +239,7 @@ { "schema_version": 0, "attributes": { - "backend_ips": [], + "backend_ips": null, "backend_vm_ids": [ "##id-1##" ], @@ -373,4 +373,4 @@ } ], "check_results": "########" -} \ No newline at end of file +} diff --git a/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref index 7f81ca54d..a721f9305 100644 --- a/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_listener_rules/TF-89_load_balancer_listener_rules_datasource_attributes_ok/step1.load_balancer_listener_rules_datasource_attributes_ok.ref @@ -371,4 +371,4 @@ } ], "check_results": "########" -} \ No newline at end of file +} diff --git a/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.ref index 3190caae9..7910f990a 100644 --- a/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_vm_health/TF-92_load_balancer_vm_health_datasource_attributes_ok/step1.load_balancer_vm_health_datasource_attributes_ok.ref @@ -377,4 +377,4 @@ } ], "check_results": "########" -} \ No newline at end of file +} diff --git a/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step1.load_balancer_vms_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step1.load_balancer_vms_resource_attributes_ok.ref index 0a8128aee..9553b7900 100644 --- a/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step1.load_balancer_vms_resource_attributes_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step1.load_balancer_vms_resource_attributes_ok.ref @@ -341,4 +341,4 @@ } ], "check_results": "########" -} \ No newline at end of file +} diff --git a/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step2.load_balancer_vms_resource_remove_vm_ok.ref b/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step2.load_balancer_vms_resource_remove_vm_ok.ref index c29ddcdc1..054a0a7bc 100644 --- a/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step2.load_balancer_vms_resource_remove_vm_ok.ref +++ b/tests/qa_provider_oapi/data/load_balancer_vms/TF-93_load_balancer_vms_resource_attributes_ok/step2.load_balancer_vms_resource_remove_vm_ok.ref @@ -119,7 +119,7 @@ { "schema_version": 0, "attributes": { - "backend_ips": [], + "backend_ips": null, "backend_vm_ids": [ "##id-1##" ], @@ -343,4 +343,4 @@ } ], "check_results": "########" -} \ No newline at end of file +} diff --git a/tests/qa_provider_oapi/data/policies_files/policy.json b/tests/qa_provider_oapi/data/policies_files/policy.json new file mode 100644 index 000000000..9a2f22fd4 --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policy.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Action": [ + "api:*" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policy11.json b/tests/qa_provider_oapi/data/policies_files/policy11.json new file mode 100644 index 000000000..9a2f22fd4 --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policy11.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Action": [ + "api:*" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policy12.json b/tests/qa_provider_oapi/data/policies_files/policy12.json new file mode 100644 index 000000000..22ede45a5 --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policy12.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Action": [ + "api:Read*" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policy2.json b/tests/qa_provider_oapi/data/policies_files/policy2.json new file mode 100644 index 000000000..8e84d35a3 --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policy2.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Action": [ + "api:*VM*" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policyV1.json b/tests/qa_provider_oapi/data/policies_files/policyV1.json new file mode 100644 index 000000000..c05dec062 --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policyV1.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "api:ReadConsumptionAccount" + ], + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policyV2.json b/tests/qa_provider_oapi/data/policies_files/policyV2.json new file mode 100644 index 000000000..ba5c9624c --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policyV2.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Action": [ + "api:Read*" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policyV3.json b/tests/qa_provider_oapi/data/policies_files/policyV3.json new file mode 100644 index 000000000..b70e6ad83 --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policyV3.json @@ -0,0 +1,9 @@ +{ + "Statement": [ + { + "Action": "*", + "Resource": "*", + "Effect": "Allow" + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policy_RO.json b/tests/qa_provider_oapi/data/policies_files/policy_RO.json new file mode 100644 index 000000000..ba5c9624c --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policy_RO.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Action": [ + "api:Read*" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/policies_files/policy_ReadAccountConsumption.json b/tests/qa_provider_oapi/data/policies_files/policy_ReadAccountConsumption.json new file mode 100644 index 000000000..c05dec062 --- /dev/null +++ b/tests/qa_provider_oapi/data/policies_files/policy_ReadAccountConsumption.json @@ -0,0 +1,13 @@ +{ + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "api:ReadConsumptionAccount" + ], + "Resource": [ + "*" + ] + } + ] +} diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step1.user_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step1.user_resource_attributes_ok.ref new file mode 100644 index 000000000..2bdcf4812 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step1.user_resource_attributes_ok.ref @@ -0,0 +1,83 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_access_key", + "name": "access_key_eim01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "access_key_id": "##id-0##", + "creation_date": "########", + "expiration_date": "2028-01-01T00:00:00.000+0000", + "id": "##id-0##", + "last_modification_date": "########", + "request_id": "########", + "secret_key": "########", + "state": "ACTIVE", + "user_name": "User-terraform-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-1##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [], + "user_email": "test-TF1@test2.fr", + "user_id": "##id-1##", + "user_name": "User-terraform-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-2##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "customer-tooling@outscale.com", + "user_id": "##id-2##", + "user_name": "User-terraform-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step1.user_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step1.user_resource_attributes_ok.tf new file mode 100644 index 000000000..0bada6709 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step1.user_resource_attributes_ok.tf @@ -0,0 +1,18 @@ +resource "outscale_user" "user-1" { + user_name = "User-terraform-1" + user_email = "test-TF1@test2.fr" + path = "/terraform/" + } + + +resource "outscale_user" "user-2" { + user_name = "User-terraform-2" + } + +resource "outscale_access_key" "access_key_eim01" { + user_name = outscale_user.user-2.user_name + state = "ACTIVE" + expiration_date = "2028-01-01" +depends_on=[outscale_user.user-2] +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step2.user_resource_update_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step2.user_resource_update_ok.ref new file mode 100644 index 000000000..043b3d305 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step2.user_resource_update_ok.ref @@ -0,0 +1,83 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_access_key", + "name": "access_key_eim01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "access_key_id": "##id-0##", + "creation_date": "########", + "expiration_date": "2028-01-01T00:00:00.000+0000", + "id": "##id-0##", + "last_modification_date": "########", + "request_id": "########", + "secret_key": "########", + "state": "ACTIVE", + "user_name": "User-terraform-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-1##", + "last_modification_date": "########", + "path": "/terraform_update/", + "policy": [], + "user_email": "test-TF11@test2.fr", + "user_id": "##id-1##", + "user_name": "User-terraform-11" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-2##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "customer-tooling@outscale.com", + "user_id": "##id-2##", + "user_name": "User-terraform-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step2.user_resource_update_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step2.user_resource_update_ok.tf new file mode 100644 index 000000000..c91f5c759 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step2.user_resource_update_ok.tf @@ -0,0 +1,18 @@ +resource "outscale_user" "user-1" { + user_name = "User-terraform-11" + user_email = "test-TF11@test2.fr" + path = "/terraform_update/" + } + + +resource "outscale_user" "user-2" { + user_name = "User-terraform-2" + } + +resource "outscale_access_key" "access_key_eim01" { + user_name = outscale_user.user-2.user_name + state = "ACTIVE" + expiration_date = "2028-01-01" +depends_on=[outscale_user.user-2] +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step3.user_resource_update_ak_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step3.user_resource_update_ak_ok.ref new file mode 100644 index 000000000..b6d5d59ae --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step3.user_resource_update_ak_ok.ref @@ -0,0 +1,83 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_access_key", + "name": "access_key_eim01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "access_key_id": "##id-0##", + "creation_date": "########", + "expiration_date": "2028-01-01T00:00:00.000+0000", + "id": "##id-0##", + "last_modification_date": "########", + "request_id": "########", + "secret_key": "########", + "state": "INACTIVE", + "user_name": "User-terraform-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-1##", + "last_modification_date": "########", + "path": "/terraform_update/", + "policy": [], + "user_email": "test-TF11@test2.fr", + "user_id": "##id-1##", + "user_name": "User-terraform-11" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-2##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "customer-tooling@outscale.com", + "user_id": "##id-2##", + "user_name": "User-terraform-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step3.user_resource_update_ak_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step3.user_resource_update_ak_ok.tf new file mode 100644 index 000000000..1e2e4072e --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF001_user_resource_with_aksk_attributes_ok/step3.user_resource_update_ak_ok.tf @@ -0,0 +1,18 @@ +resource "outscale_user" "user-1" { + user_name = "User-terraform-11" + user_email = "test-TF11@test2.fr" + path = "/terraform_update/" + } + + +resource "outscale_user" "user-2" { + user_name = "User-terraform-2" + } + +resource "outscale_access_key" "access_key_eim01" { + user_name = outscale_user.user-2.user_name + state = "INACTIVE" + expiration_date = "2028-01-01" +depends_on=[outscale_user.user-2] +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step1.user_group_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step1.user_group_resource_attributes_ok.ref new file mode 100644 index 000000000..141230c60 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step1.user_group_resource_attributes_ok.ref @@ -0,0 +1,34 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-0##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform_group/", + "policy": [], + "user": [], + "user_group_id": "##id-0##", + "user_group_name": "Group-terraform-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step1.user_group_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step1.user_group_resource_attributes_ok.tf new file mode 100644 index 000000000..46f6631b1 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step1.user_group_resource_attributes_ok.tf @@ -0,0 +1,5 @@ +resource "outscale_user_group" "group-1" { + user_group_name = "Group-terraform-test-1" + path = "/terraform_group/" + } + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step2.user_group_resource_update_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step2.user_group_resource_update_ok.ref new file mode 100644 index 000000000..263ce3dfe --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step2.user_group_resource_update_ok.ref @@ -0,0 +1,34 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-0##", + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy": [], + "user": [], + "user_group_id": "##id-0##", + "user_group_name": "Group-terraform-test-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step2.user_group_resource_update_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step2.user_group_resource_update_ok.tf new file mode 100644 index 000000000..5ba39b9d1 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF002_user_group_resource_attributes_ok/step2.user_group_resource_update_ok.tf @@ -0,0 +1,5 @@ +resource "outscale_user_group" "group-1" { + user_group_name = "Group-terraform-test-2" + path = "/" + } + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF003_policy_resource_attributes_ok/step1.policy_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF003_policy_resource_attributes_ok/step1.policy_resource_attributes_ok.ref new file mode 100644 index 000000000..3c993a00e --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF003_policy_resource_attributes_ok/step1.policy_resource_attributes_ok.ref @@ -0,0 +1,64 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-policy", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n} \n", + "id": "##id-0##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-RO-policy", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "", + "document": "{\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\n \"api:ReadConsumptionAccount\"\n ],\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n} \n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-4##", + "policy_name": "terraform-Read-Account_consumption_only", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF003_policy_resource_attributes_ok/step1.policy_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF003_policy_resource_attributes_ok/step1.policy_resource_attributes_ok.tf new file mode 100644 index 000000000..3811c84e3 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF003_policy_resource_attributes_ok/step1.policy_resource_attributes_ok.tf @@ -0,0 +1,11 @@ +resource "outscale_policy" "policy-1" { + policy_name = "terraform-RO-policy" + description = "test-policy" + document = file("data/policies_files/policy_RO.json") + path = "/terraform/" +} + +resource "outscale_policy" "policy-2" { + policy_name = "terraform-Read-Account_consumption_only" + document = file("data/policies_files/policy_ReadAccountConsumption.json") +} diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF004_policy_version_resource_attributes_ok/step1.policy_version_resource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF004_policy_version_resource_attributes_ok/step1.policy_version_resource_attributes_ok.ref new file mode 100644 index 000000000..7299a1df1 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF004_policy_version_resource_attributes_ok/step1.policy_version_resource_attributes_ok.ref @@ -0,0 +1,89 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-version", + "document": "{\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\n \"api:ReadConsumptionAccount\"\n ],\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n} \n", + "id": "##id-0##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-01", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy_version", + "name": "policy-1_version-02", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "body": "########", + "creation_date": "########", + "default_version": false, + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n} \n", + "id": "##id-3##", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-01", + "set_as_default": null, + "version_id": "##id-4##" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy_version", + "name": "version-03", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "body": "########", + "creation_date": "########", + "default_version": true, + "document": "{\n \"Statement\": [\n {\n \"Action\": \"*\",\n \"Resource\": \"*\",\n \"Effect\": \"Allow\"\n }\n ]\n}\n", + "id": "##id-5##", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-01", + "set_as_default": true, + "version_id": "##id-6##" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF004_policy_version_resource_attributes_ok/step1.policy_version_resource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF004_policy_version_resource_attributes_ok/step1.policy_version_resource_attributes_ok.tf new file mode 100644 index 000000000..c9302870b --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF004_policy_version_resource_attributes_ok/step1.policy_version_resource_attributes_ok.tf @@ -0,0 +1,18 @@ +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-01" + description = "test-version" + document = file("data/policies_files/policyV1.json") + path = "/" +} + +resource "outscale_policy_version" "policy-1_version-02" { + policy_orn = outscale_policy.policy-1.orn + document = file("data/policies_files/policyV2.json") +} + +resource "outscale_policy_version" "version-03" { + policy_orn = outscale_policy.policy-1.orn + document = file("data/policies_files/policyV3.json") + set_as_default = true +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step1.all_iam_resources_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step1.all_iam_resources_attributes_ok.ref new file mode 100644 index 000000000..93038c1f7 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step1.all_iam_resources_attributes_ok.ref @@ -0,0 +1,347 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-0##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-4##", + "policy_name": "terraform-policy-2", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-RO", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform-ro", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n} \n", + "id": "##id-5##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-6##", + "policy_name": "terraform-policy-RO", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy_version", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "body": "########", + "creation_date": "########", + "default_version": false, + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*VM*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-7##", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-2", + "set_as_default": null, + "version_id": "##id-8##" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "multiple_users", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-9##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "test-0@test2.fr", + "user_id": "##id-9##", + "user_name": "TF-User-0" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-10##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "test-1@test2.fr", + "user_id": "##id-10##", + "user_name": "TF-User-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-11##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "test-2@test2.fr", + "user_id": "##id-11##", + "user_name": "TF-User-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-12##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-1" + } + ], + "user_email": "test-TF11@test2.fr", + "user_id": "##id-12##", + "user_name": "User-TF-RW" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-13##", + "last_modification_date": "########", + "path": "/terraform2/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-8##", + "last_modification_date": "########", + "policy_id": "##id-4##", + "policy_name": "terraform-policy-2", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-2" + } + ], + "user_email": "test-TF12@test2.fr", + "user_id": "##id-13##", + "user_name": "User-TF-RW-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-No-policy", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-14##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-12##", + "user_name": "User-TF-RW" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_id": "##id-13##", + "user_name": "User-TF-RW-2" + } + ], + "user_group_id": "##id-14##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1", + "outscale_policy.policy-2", + "outscale_user.user-1", + "outscale_user.user-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-policy-RO", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-15##", + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-6##", + "policy_name": "terraform-policy-RO", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-RO" + } + ], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/", + "user_id": "##id-10##", + "user_name": "TF-User-1" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/", + "user_id": "##id-9##", + "user_name": "TF-User-0" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/", + "user_id": "##id-11##", + "user_name": "TF-User-2" + } + ], + "user_group_id": "##id-15##", + "user_group_name": "Group-TF-RO" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-RO", + "outscale_user.multiple_users" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step1.all_iam_resources_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step1.all_iam_resources_attributes_ok.tf new file mode 100644 index 000000000..6b7ebadf2 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step1.all_iam_resources_attributes_ok.tf @@ -0,0 +1,90 @@ +resource "outscale_user" "user-1" { + user_name = "User-TF-RW" + user_email = "test-TF11@test2.fr" + path = "/terraform/" + policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +resource "outscale_user" "user-2" { + user_name = "User-TF-RW-2" + user_email = "test-TF12@test2.fr" + path = "/terraform2/" + policy { + policy_orn = outscale_policy.policy-2.orn + default_version_id = "V2" + } +} + + +resource "outscale_user_group" "group-No-policy" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } + user { + user_name = outscale_user.user-2.user_name + path = "/terraform2/" + } +depends_on=[outscale_user.user-1,outscale_user.user-2] +} + + +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-1" + description = "test-terraform" + document = file("data/policies_files/policy.json") + path = "/" +} + +resource "outscale_policy" "policy-2" { + policy_name = "terraform-policy-2" + description = "test-terraform" + document = file("data/policies_files/policy.json") + path = "/" +} + +resource "outscale_policy_version" "policy-2" { + policy_orn = outscale_policy.policy-2.orn + document = file("data/policies_files/policy2.json") +} + +#################################################################@ + +#####Create the users belonging to the same policy group#### +resource "outscale_user" "multiple_users" { + count=3 + user_name = "TF-User-${count.index}" + user_email = "test-${count.index}@test2.fr" +} + + + +resource "outscale_user_group" "group-policy-RO" { + user_group_name = "Group-TF-RO" + user { + user_name = outscale_user.multiple_users[0].user_name + } + user { + user_name = outscale_user.multiple_users[1].user_name + } + user { + user_name = outscale_user.multiple_users[2].user_name + } +policy { + policy_orn = outscale_policy.policy-RO.orn + } +depends_on=[outscale_user.multiple_users[0],outscale_user.multiple_users[1],outscale_user.multiple_users[2]] +} + + +resource "outscale_policy" "policy-RO" { + policy_name = "terraform-policy-RO" + description = "test-terraform-ro" + document = file("data/policies_files/policy_RO.json") + path = "/" +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step2.all_iam_resources_update_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step2.all_iam_resources_update_ok.ref new file mode 100644 index 000000000..fe68871ea --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step2.all_iam_resources_update_ok.ref @@ -0,0 +1,347 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-0##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "resources_count": 1 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-4##", + "policy_id": "##id-5##", + "policy_name": "terraform-policy-2", + "resources_count": 1 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-RO", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform-ro", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n} \n", + "id": "##id-6##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-7##", + "policy_name": "terraform-policy-RO", + "resources_count": 1 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy_version", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "body": "########", + "creation_date": "########", + "default_version": true, + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*VM*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-8##", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-2", + "set_as_default": null, + "version_id": "##id-4##" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "multiple_users", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-9##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "test-0@test2.fr", + "user_id": "##id-9##", + "user_name": "TF-User-0-3" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-10##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "test-1@test2.fr", + "user_id": "##id-10##", + "user_name": "TF-User-1-3" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-11##", + "last_modification_date": "########", + "path": "/", + "policy": [], + "user_email": "test-2@test2.fr", + "user_id": "##id-11##", + "user_name": "TF-User-2-3" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-12##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-1" + } + ], + "user_email": "test-TF11@test2.fr", + "user_id": "##id-12##", + "user_name": "User-TF-RW-11" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-13##", + "last_modification_date": "########", + "path": "/terraform2/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-4##", + "last_modification_date": "########", + "policy_id": "##id-5##", + "policy_name": "terraform-policy-2", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-2" + } + ], + "user_email": "test-TF12@test2.fr", + "user_id": "##id-13##", + "user_name": "User-TF-RW-22" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-No-policy", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-14##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-12##", + "user_name": "User-TF-RW-11" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_id": "##id-13##", + "user_name": "User-TF-RW-22" + } + ], + "user_group_id": "##id-14##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1", + "outscale_policy.policy-2", + "outscale_user.user-1", + "outscale_user.user-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-policy-RO", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-15##", + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-7##", + "policy_name": "terraform-policy-RO", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-RO" + } + ], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/", + "user_id": "##id-10##", + "user_name": "TF-User-1-3" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/", + "user_id": "##id-11##", + "user_name": "TF-User-2-3" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/", + "user_id": "##id-9##", + "user_name": "TF-User-0-3" + } + ], + "user_group_id": "##id-15##", + "user_group_name": "Group-TF-RO" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-RO", + "outscale_user.multiple_users" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step2.all_iam_resources_update_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step2.all_iam_resources_update_ok.tf new file mode 100644 index 000000000..fb5a712f4 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF005_all_iam_resources_attributes_ok/step2.all_iam_resources_update_ok.tf @@ -0,0 +1,90 @@ +resource "outscale_user" "user-1" { + user_name = "User-TF-RW-11" + user_email = "test-TF11@test2.fr" + path = "/terraform/" + policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +resource "outscale_user" "user-2" { + user_name = "User-TF-RW-22" + user_email = "test-TF12@test2.fr" + path = "/terraform2/" + policy { + policy_orn = outscale_policy.policy-2.orn + default_version_id = "V2" + } +} + + +resource "outscale_user_group" "group-No-policy" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } + user { + user_name = outscale_user.user-2.user_name + path = "/terraform2/" + } +depends_on=[outscale_user.user-1,outscale_user.user-2] +} + + +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-1" + description = "test-terraform" + document = file("data/policies_files/policy.json") + path = "/" +} + +resource "outscale_policy" "policy-2" { + policy_name = "terraform-policy-2" + description = "test-terraform" + document = file("data/policies_files/policy.json") + path = "/" +} + +resource "outscale_policy_version" "policy-2" { + policy_orn = outscale_policy.policy-2.orn + document = file("data/policies_files/policy2.json") +} + +#################################################################@ + +#####Create the users belonging to the same policy group#### +resource "outscale_user" "multiple_users" { + count=3 + user_name = "TF-User-${count.index}-3" + user_email = "test-${count.index}@test2.fr" +} + + + +resource "outscale_user_group" "group-policy-RO" { + user_group_name = "Group-TF-RO" + user { + user_name = outscale_user.multiple_users[0].user_name + } + user { + user_name = outscale_user.multiple_users[1].user_name + } + user { + user_name = outscale_user.multiple_users[2].user_name + } +policy { + policy_orn = outscale_policy.policy-RO.orn + } +depends_on=[outscale_user.multiple_users[0],outscale_user.multiple_users[1],outscale_user.multiple_users[2]] +} + + +resource "outscale_policy" "policy-RO" { + policy_name = "terraform-policy-RO" + description = "test-terraform-ro" + document = file("data/policies_files/policy_RO.json") + path = "/" +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF006_user_datasource_attribute_ok/step2.user_datasource_after_update_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF006_user_datasource_attribute_ok/step2.user_datasource_after_update_ok.ref new file mode 100644 index 000000000..5cb62a42a --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF006_user_datasource_attribute_ok/step2.user_datasource_after_update_ok.ref @@ -0,0 +1,134 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_access_key", + "name": "access_key_user01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "access_key_id": "##id-0##", + "creation_date": "########", + "expiration_date": "", + "filter": "########", + "id": "##id-0##", + "last_modification_date": "########", + "request_id": "########", + "state": "INACTIVE", + "user_name": "User-TF-65" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "data", + "type": "outscale_access_keys", + "name": "access_keys_user01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "access_key_ids": null, + "access_keys": [ + { + "access_key_id": "##id-0##", + "creation_date": "########", + "expiration_date": "", + "last_modification_date": "########", + "state": "INACTIVE" + } + ], + "filter": "########", + "id": "##id-1##", + "request_id": "########", + "states": null, + "user_name": "User-TF-65" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "data", + "type": "outscale_user", + "name": "user01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "filter": "########", + "id": "##id-2##", + "last_modification_date": "########", + "path": "/test/terraform/", + "user_email": "test@test65.fr", + "user_id": "##id-3##", + "user_name": "User-TF-65" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_access_key", + "name": "access_key_01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "access_key_id": "##id-0##", + "creation_date": "########", + "expiration_date": "", + "id": "##id-0##", + "last_modification_date": "########", + "request_id": "########", + "secret_key": "########", + "state": "INACTIVE", + "user_name": "User-TF-65" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-3##", + "last_modification_date": "########", + "path": "/test/terraform/", + "policy": [], + "user_email": "test@test65.fr", + "user_id": "##id-3##", + "user_name": "User-TF-65" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF006_user_datasource_attribute_ok/step2.user_datasource_after_update_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF006_user_datasource_attribute_ok/step2.user_datasource_after_update_ok.tf new file mode 100644 index 000000000..cf0bce4ef --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF006_user_datasource_attribute_ok/step2.user_datasource_after_update_ok.tf @@ -0,0 +1,45 @@ +resource "outscale_user" "user1" { + user_name = "User-TF-65" + user_email = "test@test65.fr" + path = "/test/terraform/" +} + +resource "outscale_access_key" "access_key_01" { + user_name = outscale_user.user1.user_name + expiration_date = "2038-01-01" + state = "INACTIVE" +depends_on=[outscale_user.user1] +} + + +data "outscale_user" "user01" { + filter { + name = "user_ids" + values = [outscale_user.user1.user_id] + } +} + +data "outscale_access_key" "access_key_user01" { + user_name = outscale_user.user1.user_name + filter { + name = "access_key_ids" + values = [outscale_access_key.access_key_01.access_key_id] + } + + filter { + name = "states" + values = ["INACTIVE"] + } +depends_on=[outscale_user.user1] +} + + +data "outscale_access_keys" "access_keys_user01" { + user_name = outscale_user.user1.user_name + filter { + name = "access_key_ids" + values = [outscale_access_key.access_key_01.access_key_id] + } +depends_on=[outscale_user.user1] +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF007_users_datasource_attributes_ok/step1.users_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF007_users_datasource_attributes_ok/step1.users_datasource_attributes_ok.ref new file mode 100644 index 000000000..a9d6d4f8a --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF007_users_datasource_attributes_ok/step1.users_datasource_attributes_ok.ref @@ -0,0 +1,90 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_users", + "name": "my_users", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "filter": "########", + "id": "##id-0##", + "users": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_email": "test-TF11@test2.fr", + "user_id": "##id-1##", + "user_name": "User-TF-11" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_email": "test-TF12@test2.fr", + "user_id": "##id-2##", + "user_name": "User-TF-12" + } + ] + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-1##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [], + "user_email": "test-TF11@test2.fr", + "user_id": "##id-1##", + "user_name": "User-TF-11" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-2##", + "last_modification_date": "########", + "path": "/terraform2/", + "policy": [], + "user_email": "test-TF12@test2.fr", + "user_id": "##id-2##", + "user_name": "User-TF-12" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF007_users_datasource_attributes_ok/step1.users_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF007_users_datasource_attributes_ok/step1.users_datasource_attributes_ok.tf new file mode 100644 index 000000000..364f01fe2 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF007_users_datasource_attributes_ok/step1.users_datasource_attributes_ok.tf @@ -0,0 +1,19 @@ +resource "outscale_user" "user-1" { + user_name = "User-TF-11" + user_email = "test-TF11@test2.fr" + path = "/terraform/" +} + +resource "outscale_user" "user-2" { + user_name = "User-TF-12" + user_email = "test-TF12@test2.fr" + path = "/terraform2/" +} + +data "outscale_users" "my_users" { + filter { + name = "user_ids" + values = [outscale_user.user-1.user_id,outscale_user.user-2.user_id] + } +} + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF008_user_group_datasource_attributes_ok/step1.user_group_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF008_user_group_datasource_attributes_ok/step1.user_group_datasource_attributes_ok.ref new file mode 100644 index 000000000..acd370b0d --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF008_user_group_datasource_attributes_ok/step1.user_group_datasource_attributes_ok.ref @@ -0,0 +1,138 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_user_group", + "name": "user_group01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-0##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_email": "test-TF011@test2.fr", + "user_id": "##id-1##", + "user_name": "User-TF-001" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_email": "test-TF002@test2.fr", + "user_id": "##id-2##", + "user_name": "User-TF-002" + } + ], + "user_group_id": "##id-3##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-1##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [], + "user_email": "test-TF011@test2.fr", + "user_id": "##id-1##", + "user_name": "User-TF-001" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-2##", + "last_modification_date": "########", + "path": "/terraform2/", + "policy": [], + "user_email": "test-TF002@test2.fr", + "user_id": "##id-2##", + "user_name": "User-TF-002" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-3##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-1##", + "user_name": "User-TF-001" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_id": "##id-2##", + "user_name": "User-TF-002" + } + ], + "user_group_id": "##id-3##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user-1", + "outscale_user.user-2" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF008_user_group_datasource_attributes_ok/step1.user_group_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF008_user_group_datasource_attributes_ok/step1.user_group_datasource_attributes_ok.tf new file mode 100644 index 000000000..637ada987 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF008_user_group_datasource_attributes_ok/step1.user_group_datasource_attributes_ok.tf @@ -0,0 +1,37 @@ +resource "outscale_user" "user-1" { + user_name = "User-TF-001" + user_email = "test-TF011@test2.fr" + path = "/terraform/" +} + +resource "outscale_user" "user-2" { + user_name = "User-TF-002" + user_email = "test-TF002@test2.fr" + path = "/terraform2/" +} + + + +resource "outscale_user_group" "group-1" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } + user { + user_name = outscale_user.user-2.user_name + path = "/terraform2/" + } +depends_on=[outscale_user.user-1,outscale_user.user-2] +} + + + +data "outscale_user_group" "user_group01" { + user_group_name = outscale_user_group.group-1.user_group_name + path = outscale_user_group.group-1.path +depends_on=[outscale_user_group.group-1] +} + + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF009_user_groups_datasource_attributes_ok/step1.user_groups_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF009_user_groups_datasource_attributes_ok/step1.user_groups_datasource_attributes_ok.ref new file mode 100644 index 000000000..256f1aac7 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF009_user_groups_datasource_attributes_ok/step1.user_groups_datasource_attributes_ok.ref @@ -0,0 +1,183 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_user_groups", + "name": "usegroups01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "filter": "########", + "id": "##id-0##", + "user_groups": [ + { + "creation_date": "########", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "user_group_id": "##id-1##", + "user_group_name": "Group-TF-test-1" + } + ] + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "data", + "type": "outscale_user_groups", + "name": "usegroups02", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "filter": "########", + "id": "##id-2##", + "user_groups": [ + { + "creation_date": "########", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform3/", + "user_group_id": "##id-3##", + "user_group_name": "Group-TF-test-2" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "user_group_id": "##id-1##", + "user_group_name": "Group-TF-test-1" + } + ] + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-4##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [], + "user_email": "test-TF11@test2.fr", + "user_id": "##id-4##", + "user_name": "User-TF-11" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-5##", + "last_modification_date": "########", + "path": "/terraform2/", + "policy": [], + "user_email": "test-TF12@test2.fr", + "user_id": "##id-5##", + "user_name": "User-TF-12" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-1##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-4##", + "user_name": "User-TF-11" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_id": "##id-5##", + "user_name": "User-TF-12" + } + ], + "user_group_id": "##id-1##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user-1", + "outscale_user.user-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-3##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform3/", + "policy": [], + "user": [], + "user_group_id": "##id-3##", + "user_group_name": "Group-TF-test-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF009_user_groups_datasource_attributes_ok/step1.user_groups_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF009_user_groups_datasource_attributes_ok/step1.user_groups_datasource_attributes_ok.tf new file mode 100644 index 000000000..56ffa617e --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF009_user_groups_datasource_attributes_ok/step1.user_groups_datasource_attributes_ok.tf @@ -0,0 +1,49 @@ +resource "outscale_user" "user-1" { + user_name = "User-TF-11" + user_email = "test-TF11@test2.fr" + path = "/terraform/" +} + +resource "outscale_user" "user-2" { + user_name = "User-TF-12" + user_email = "test-TF12@test2.fr" + path = "/terraform2/" +} + +resource "outscale_user_group" "group-1" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } + user { + user_name = outscale_user.user-2.user_name + path = "/terraform2/" + } +depends_on=[outscale_user.user-1,outscale_user.user-2] +} + +resource "outscale_user_group" "group-2" { + user_group_name = "Group-TF-test-2" + path = "/terraform3/" +} + + +data "outscale_user_groups" "usegroups01" { + filter { + name = "user_group_ids" + values = [outscale_user_group.group-1.user_group_id,outscale_user_group.group-2.user_group_id] + } + filter { + name = "path_prefix" + values = [outscale_user_group.group-1.path] + } +} + +data "outscale_user_groups" "usegroups02" { + filter { + name = "user_group_ids" + values = [outscale_user_group.group-1.user_group_id,outscale_user_group.group-2.user_group_id] + } +} diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF010_policy_datasource_attributes_ok/step1.policy_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF010_policy_datasource_attributes_ok/step1.policy_datasource_attributes_ok.ref new file mode 100644 index 000000000..a1f2b2a8e --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF010_policy_datasource_attributes_ok/step1.policy_datasource_attributes_ok.ref @@ -0,0 +1,161 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_policy", + "name": "user_policy01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform-11", + "document": null, + "id": "##id-0##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-11", + "resources_count": 2 + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform-11", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-4##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy_version", + "name": "policy11-version-02", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "body": "########", + "creation_date": "########", + "default_version": true, + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-5##", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-11", + "set_as_default": true, + "version_id": "##id-1##" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-6##", + "last_modification_date": "########", + "path": "/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-11" + } + ], + "user_email": "customer-tooling@outscale.com", + "user_id": "##id-6##", + "user_name": "User-TF-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-7##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-11" + } + ], + "user": [], + "user_group_id": "##id-7##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF010_policy_datasource_attributes_ok/step1.policy_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF010_policy_datasource_attributes_ok/step1.policy_datasource_attributes_ok.tf new file mode 100644 index 000000000..98813ea4f --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF010_policy_datasource_attributes_ok/step1.policy_datasource_attributes_ok.tf @@ -0,0 +1,31 @@ +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-11" + description = "test-terraform-11" + document = file("data/policies_files/policy11.json") + path = "/" +} +resource "outscale_policy_version" "policy11-version-02" { + policy_orn = outscale_policy.policy-1.orn + document = file("data/policies_files/policy12.json") + set_as_default = true +} + +resource "outscale_user" "user-1" { + user_name = "User-TF-1" + policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +resource "outscale_user_group" "group-1" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" +policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +data "outscale_policy" "user_policy01" { + policy_orn = outscale_policy.policy-1.orn +depends_on=[outscale_policy_version.policy11-version-02,outscale_user.user-1,outscale_user_group.group-1] +} diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF011_policies_datasource_attributes_ok/step1.policies_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF011_policies_datasource_attributes_ok/step1.policies_datasource_attributes_ok.ref new file mode 100644 index 000000000..881fa0f21 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF011_policies_datasource_attributes_ok/step1.policies_datasource_attributes_ok.ref @@ -0,0 +1,191 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_policies", + "name": "Mypolicies01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "filter": "########", + "id": "##id-0##", + "policies": [ + { + "creation_date": "########", + "description": "test-terraform-11", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/policy1/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "resources_count": 0 + } + ] + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform-11", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/policy1/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-12", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform-12", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-4##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/policy12/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-5##", + "policy_name": "terraform-policy-12", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy_version", + "name": "policy11-version-02", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "body": "########", + "creation_date": "########", + "default_version": true, + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-6##", + "policy_orn": "orn:ows:idauth::339215505907:policy/policy1/terraform-policy-11", + "set_as_default": true, + "version_id": "##id-7##" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-8##", + "last_modification_date": "########", + "path": "/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-7##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "policy_orn": "orn:ows:idauth::339215505907:policy/policy1/terraform-policy-11" + } + ], + "user_email": "customer-tooling@outscale.com", + "user_id": "##id-8##", + "user_name": "User-TF-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-9##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-7##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-11", + "policy_orn": "orn:ows:idauth::339215505907:policy/policy1/terraform-policy-11" + } + ], + "user": [], + "user_group_id": "##id-9##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF011_policies_datasource_attributes_ok/step1.policies_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF011_policies_datasource_attributes_ok/step1.policies_datasource_attributes_ok.tf new file mode 100644 index 000000000..843ccc893 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF011_policies_datasource_attributes_ok/step1.policies_datasource_attributes_ok.tf @@ -0,0 +1,41 @@ +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-11" + description = "test-terraform-11" + document = file("data/policies_files/policy11.json") + path = "/policy1/" +} +resource "outscale_policy_version" "policy11-version-02" { + policy_orn = outscale_policy.policy-1.orn + document = file("data/policies_files/policy12.json") + set_as_default = true +} + +resource "outscale_user" "user-1" { + user_name = "User-TF-1" + policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +resource "outscale_user_group" "group-1" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" +policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +resource "outscale_policy" "policy-12" { + policy_name = "terraform-policy-12" + description = "test-terraform-12" + document = file("data/policies_files/policy12.json") + path = "/policy12/" +} + + +data "outscale_policies" "Mypolicies01" { + filter { + name = "path_prefix" + values = [outscale_policy.policy-1.path,outscale_policy.policy-12.path] + } +} diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF012_policies_linked_to_user_datasource_attributes_ok/step1.policies_linked_to_user_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF012_policies_linked_to_user_datasource_attributes_ok/step1.policies_linked_to_user_datasource_attributes_ok.ref new file mode 100644 index 000000000..d865930e0 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF012_policies_linked_to_user_datasource_attributes_ok/step1.policies_linked_to_user_datasource_attributes_ok.ref @@ -0,0 +1,140 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_policies_linked_to_user", + "name": "linked_policy01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "##id-0##", + "policies": [ + { + "creation_date": "########", + "last_modification_date": "########", + "orn": "########", + "policy_id": "##id-1##", + "policy_name": "terraform-policy-1" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "orn": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-2" + } + ], + "user_name": "User-TF-linkPolicy" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-4##", + "policy_id": "##id-1##", + "policy_name": "terraform-policy-1", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform-2", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-5##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/terraform2/", + "policy_default_version_id": "##id-4##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-2", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-policy", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-6##", + "last_modification_date": "########", + "path": "/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-4##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-2", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform2/terraform-policy-2" + }, + { + "creation_date": "########", + "default_version_id": "##id-4##", + "last_modification_date": "########", + "policy_id": "##id-1##", + "policy_name": "terraform-policy-1", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-1" + } + ], + "user_email": "customer-tooling@outscale.com", + "user_id": "##id-6##", + "user_name": "User-TF-linkPolicy" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1", + "outscale_policy.policy-2" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF012_policies_linked_to_user_datasource_attributes_ok/step1.policies_linked_to_user_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF012_policies_linked_to_user_datasource_attributes_ok/step1.policies_linked_to_user_datasource_attributes_ok.tf new file mode 100644 index 000000000..0df5e2cb8 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF012_policies_linked_to_user_datasource_attributes_ok/step1.policies_linked_to_user_datasource_attributes_ok.tf @@ -0,0 +1,31 @@ +resource "outscale_user" "user-policy" { + user_name = "User-TF-linkPolicy" + policy { + policy_orn = outscale_policy.policy-1.orn + } + policy { + policy_orn = outscale_policy.policy-2.orn + } +} +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-1" + description = "test-terraform" + document = file("data/policies_files/policy11.json") + path = "/" +} + +resource "outscale_policy" "policy-2" { + policy_name = "terraform-policy-2" + description = "test-terraform-2" + document = file("data/policies_files/policy12.json") + path = "/terraform2/" +} + + +data "outscale_policies_linked_to_user" "linked_policy01" { + + user_name= outscale_user.user-policy.user_name + +depends_on=[outscale_user.user-policy] + +} diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF013_policies_linked_to_user_group_datasource_attributes_ok/step1.policies_linked_to_user_group_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF013_policies_linked_to_user_group_datasource_attributes_ok/step1.policies_linked_to_user_group_datasource_attributes_ok.ref new file mode 100644 index 000000000..ab983c8f2 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF013_policies_linked_to_user_group_datasource_attributes_ok/step1.policies_linked_to_user_group_datasource_attributes_ok.ref @@ -0,0 +1,142 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_policies_linked_to_user_group", + "name": "managed_policies_linked_to_user_group", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "filter": "########", + "id": "##id-0##", + "policies": [ + { + "creation_date": "########", + "last_modification_date": "########", + "orn": "########", + "policy_id": "##id-1##", + "policy_name": "terraform-policy-1" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "orn": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-2" + } + ], + "user_group_name": "Group-TF-policy-1" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-4##", + "policy_id": "##id-1##", + "policy_name": "terraform-policy-1", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:Read*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-5##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/terraform2/", + "policy_default_version_id": "##id-4##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-2", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-6##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-4##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-2", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform2/terraform-policy-2" + }, + { + "creation_date": "########", + "default_version_id": "##id-4##", + "last_modification_date": "########", + "policy_id": "##id-1##", + "policy_name": "terraform-policy-1", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-1" + } + ], + "user": [], + "user_group_id": "##id-6##", + "user_group_name": "Group-TF-policy-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1", + "outscale_policy.policy-2" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF013_policies_linked_to_user_group_datasource_attributes_ok/step1.policies_linked_to_user_group_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF013_policies_linked_to_user_group_datasource_attributes_ok/step1.policies_linked_to_user_group_datasource_attributes_ok.tf new file mode 100644 index 000000000..12bfde597 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF013_policies_linked_to_user_group_datasource_attributes_ok/step1.policies_linked_to_user_group_datasource_attributes_ok.tf @@ -0,0 +1,30 @@ +resource "outscale_user_group" "group-1" { + user_group_name = "Group-TF-policy-1" + path = "/terraform/" + policy { + policy_orn = outscale_policy.policy-1.orn + } + + policy { + policy_orn = outscale_policy.policy-2.orn + } +} + +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-1" + description = "test-terraform" + document = file("data/policies_files/policy11.json") + path = "/" +} + +resource "outscale_policy" "policy-2" { + policy_name = "terraform-policy-2" + description = "test-terraform" + document = file("data/policies_files/policy12.json") + path = "/terraform2/" +} + +data "outscale_policies_linked_to_user_group" "managed_policies_linked_to_user_group" { + user_group_name= outscale_user_group.group-1.user_group_name +depends_on=[outscale_user_group.group-1] +} diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF014_entities_linked_to_policy_datasource_attributes_ok/step1.entities_linked_to_policy_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF014_entities_linked_to_policy_datasource_attributes_ok/step1.entities_linked_to_policy_datasource_attributes_ok.ref new file mode 100644 index 000000000..478756f55 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF014_entities_linked_to_policy_datasource_attributes_ok/step1.entities_linked_to_policy_datasource_attributes_ok.ref @@ -0,0 +1,250 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-0##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_policy", + "name": "policy-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "description": "test-terraform", + "document": "{\n \"Statement\": [\n {\n \"Action\": [\n \"api:*\"\n ],\n \"Effect\": \"Allow\",\n \"Resource\": [\n \"*\"\n ]\n }\n ]\n}\n", + "id": "##id-3##", + "is_linkable": true, + "last_modification_date": "########", + "orn": "########", + "path": "/terraform2/", + "policy_default_version_id": "##id-1##", + "policy_id": "##id-4##", + "policy_name": "terraform-policy-2", + "resources_count": 0 + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-5##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-1" + } + ], + "user_email": "test-TF11@test2.fr", + "user_id": "##id-5##", + "user_name": "User-TF-11" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-6##", + "last_modification_date": "########", + "path": "/terraform2/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-1" + } + ], + "user_email": "test-TF12@test2.fr", + "user_id": "##id-6##", + "user_name": "User-TF-12" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-7##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-4##", + "policy_name": "terraform-policy-2", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform2/terraform-policy-2" + }, + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-2##", + "policy_name": "terraform-policy-1", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform-policy-1" + } + ], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-5##", + "user_name": "User-TF-11" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_id": "##id-6##", + "user_name": "User-TF-12" + } + ], + "user_group_id": "##id-7##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1", + "outscale_policy.policy-2", + "outscale_user.user-1", + "outscale_user.user-2" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-8##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform3/", + "policy": [ + { + "creation_date": "########", + "default_version_id": "##id-1##", + "last_modification_date": "########", + "policy_id": "##id-4##", + "policy_name": "terraform-policy-2", + "policy_orn": "orn:ows:idauth::339215505907:policy/terraform2/terraform-policy-2" + } + ], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-5##", + "user_name": "User-TF-11" + }, + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform2/", + "user_id": "##id-6##", + "user_name": "User-TF-12" + } + ], + "user_group_id": "##id-8##", + "user_group_name": "Group-TF-test-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_policy.policy-1", + "outscale_policy.policy-2", + "outscale_user.user-1", + "outscale_user.user-2" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF014_entities_linked_to_policy_datasource_attributes_ok/step1.entities_linked_to_policy_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF014_entities_linked_to_policy_datasource_attributes_ok/step1.entities_linked_to_policy_datasource_attributes_ok.tf new file mode 100644 index 000000000..c0c60448c --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF014_entities_linked_to_policy_datasource_attributes_ok/step1.entities_linked_to_policy_datasource_attributes_ok.tf @@ -0,0 +1,71 @@ +resource "outscale_user" "user-1" { + user_name = "User-TF-11" + user_email = "test-TF11@test2.fr" + path = "/terraform/" + policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +resource "outscale_user" "user-2" { + user_name = "User-TF-12" + user_email = "test-TF12@test2.fr" + path = "/terraform2/" + policy { + policy_orn = outscale_policy.policy-1.orn + } +} + +resource "outscale_user_group" "group-1" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } + user { + user_name = outscale_user.user-2.user_name + path = "/terraform2/" + } + policy { + policy_orn = outscale_policy.policy-1.orn + } + + policy { + policy_orn = outscale_policy.policy-2.orn + } +depends_on=[outscale_user.user-1,outscale_user.user-2] +} + +resource "outscale_user_group" "group-2" { + user_group_name = "Group-TF-test-2" + path = "/terraform3/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } + user { + user_name = outscale_user.user-2.user_name + path = "/terraform2/" + } +policy { + policy_orn = outscale_policy.policy-2.orn + } +depends_on=[outscale_user.user-1,outscale_user.user-2] +} + +resource "outscale_policy" "policy-1" { + policy_name = "terraform-policy-1" + description = "test-terraform" + document = file("data/policies_files/policy.json") + path = "/" +} + +resource "outscale_policy" "policy-2" { + policy_name = "terraform-policy-2" + description = "test-terraform" + document = file("data/policies_files/policy.json") + path = "/terraform2/" +} + + diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF015_user_groups_per_user_datasource_attributes_ok/step1.user_groups_per_user_datasource_attributes_ok.ref b/tests/qa_provider_oapi/data/tests_iam_resources/TF015_user_groups_per_user_datasource_attributes_ok/step1.user_groups_per_user_datasource_attributes_ok.ref new file mode 100644 index 000000000..c8c017115 --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF015_user_groups_per_user_datasource_attributes_ok/step1.user_groups_per_user_datasource_attributes_ok.ref @@ -0,0 +1,121 @@ +{ + "version": "########", + "terraform_version": "########", + "serial": "########", + "lineage": "########", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "outscale_user_groups_per_user", + "name": "usegroups_per_user01", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "##id-0##", + "user_groups": [], + "user_name": "User-TF-group1", + "user_path": "/terraform/" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user", + "name": "user-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-1##", + "last_modification_date": "########", + "path": "/terraform/", + "policy": [], + "user_email": "customer-tooling@outscale.com", + "user_id": "##id-1##", + "user_name": "User-TF-group1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-1", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-2##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform/", + "policy": [], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-1##", + "user_name": "User-TF-group1" + } + ], + "user_group_id": "##id-2##", + "user_group_name": "Group-TF-test-1" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "outscale_user_group", + "name": "group-2", + "provider": "provider[\"registry.terraform.io/outscale/outscale\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "creation_date": "########", + "id": "##id-3##", + "last_modification_date": "########", + "orn": "########", + "path": "/terraform3/", + "policy": [], + "user": [ + { + "creation_date": "########", + "last_modification_date": "########", + "path": "/terraform/", + "user_id": "##id-1##", + "user_name": "User-TF-group1" + } + ], + "user_group_id": "##id-3##", + "user_group_name": "Group-TF-test-2" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "outscale_user.user-1" + ] + } + ] + } + ], + "check_results": "########" +} \ No newline at end of file diff --git a/tests/qa_provider_oapi/data/tests_iam_resources/TF015_user_groups_per_user_datasource_attributes_ok/step1.user_groups_per_user_datasource_attributes_ok.tf b/tests/qa_provider_oapi/data/tests_iam_resources/TF015_user_groups_per_user_datasource_attributes_ok/step1.user_groups_per_user_datasource_attributes_ok.tf new file mode 100644 index 000000000..d506ebafe --- /dev/null +++ b/tests/qa_provider_oapi/data/tests_iam_resources/TF015_user_groups_per_user_datasource_attributes_ok/step1.user_groups_per_user_datasource_attributes_ok.tf @@ -0,0 +1,33 @@ +resource "outscale_user" "user-1" { + user_name = "User-TF-group1" + path = "/terraform/" +} + + + +resource "outscale_user_group" "group-1" { + user_group_name = "Group-TF-test-1" + path = "/terraform/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } +depends_on=[outscale_user.user-1] +} + + + +resource "outscale_user_group" "group-2" { + user_group_name = "Group-TF-test-2" + path = "/terraform3/" + user { + user_name = outscale_user.user-1.user_name + path = "/terraform/" + } +depends_on=[outscale_user.user-1] +} + +data "outscale_user_groups_per_user" "usegroups_per_user01" { + user_name = outscale_user.user-1.user_name + user_path = outscale_user.user-1.path +} diff --git a/tests/qa_provider_oapi/test_provider_oapi.py b/tests/qa_provider_oapi/test_provider_oapi.py index c9d89298d..651906fad 100644 --- a/tests/qa_provider_oapi/test_provider_oapi.py +++ b/tests/qa_provider_oapi/test_provider_oapi.py @@ -52,7 +52,8 @@ 'available_ips_count', 'load_balancer_name', 'load_balancer_names', - 'listener_rule_name'] + 'listener_rule_name', + 'backend_ips'] IGNORE_END_PATHS = [] TINA_ID_PREFIXES = ['i', 'subnet', 'snap', 'img', 'vol', 'eni', 'vpc', 'igw', 'nat', 'vgw', 'pcx', 'sg', 'rtb', 'rtbassoc', 'vpn', 'vpcconn', 'ami', 'dxvif','vpce','fgpu','aar','ca'] VARIABLES_FILE_NAME = ['resources.auto.tfvars']