From eb05ecb29b8b67b2775ee9c9ec6b92580b432610 Mon Sep 17 00:00:00 2001 From: Nir Argaman Date: Tue, 12 Sep 2023 21:18:23 +0300 Subject: [PATCH] OCM-3210: ocm_policies_data_source also expose shared vpc operator policy --- provider/ocm_policies_data_source.go | 19 +++++++++++++------ provider/ocm_policies_state.go | 13 +++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/provider/ocm_policies_data_source.go b/provider/ocm_policies_data_source.go index 58c0a984..59968a12 100644 --- a/provider/ocm_policies_data_source.go +++ b/provider/ocm_policies_data_source.go @@ -29,12 +29,13 @@ import ( const ( // Policy IDs from type operator roles - CloudCred = "openshift_cloud_credential_operator_cloud_credential_operator_iam_ro_creds_policy" - CloudNetwork = "openshift_cloud_network_config_controller_cloud_credentials_policy" - ClusterCSI = "openshift_cluster_csi_drivers_ebs_cloud_credentials_policy" - ImageRegistry = "openshift_image_registry_installer_cloud_credentials_policy" - IngressOperator = "openshift_ingress_operator_cloud_credentials_policy" - MachineAPI = "openshift_machine_api_aws_cloud_credentials_policy" + CloudCred = "openshift_cloud_credential_operator_cloud_credential_operator_iam_ro_creds_policy" + CloudNetwork = "openshift_cloud_network_config_controller_cloud_credentials_policy" + ClusterCSI = "openshift_cluster_csi_drivers_ebs_cloud_credentials_policy" + ImageRegistry = "openshift_image_registry_installer_cloud_credentials_policy" + IngressOperator = "openshift_ingress_operator_cloud_credentials_policy" + SharedVpcIngressOperator = "shared_vpc_openshift_ingress_operator_cloud_credentials_policy" + MachineAPI = "openshift_machine_api_aws_cloud_credentials_policy" // Policy IDs from type account roles Installer = "sts_installer_permission_policy" @@ -113,6 +114,10 @@ func operatorRolePoliciesNames() tfsdk.NestedAttributes { Type: types.StringType, Computed: true, }, + SharedVpcIngressOperator: { + Type: types.StringType, + Computed: true, + }, MachineAPI: { Type: types.StringType, Computed: true, @@ -167,6 +172,8 @@ func (t *OcmPoliciesDataSource) Read(ctx context.Context, request tfsdk.ReadData operatorRolePolicies.ImageRegistry = types.String{Value: awsPolicy.Details()} case IngressOperator: operatorRolePolicies.IngressOperator = types.String{Value: awsPolicy.Details()} + case SharedVpcIngressOperator: + operatorRolePolicies.SharedVpcIngressOperator = types.String{Value: awsPolicy.Details()} case MachineAPI: operatorRolePolicies.MachineAPI = types.String{Value: awsPolicy.Details()} // account roles diff --git a/provider/ocm_policies_state.go b/provider/ocm_policies_state.go index 40ff2854..9eef96bb 100644 --- a/provider/ocm_policies_state.go +++ b/provider/ocm_policies_state.go @@ -24,12 +24,13 @@ type OcmPoliciesState struct { } type OperatorRolePolicies struct { - CloudCred types.String `tfsdk:"openshift_cloud_credential_operator_cloud_credential_operator_iam_ro_creds_policy"` - CloudNetwork types.String `tfsdk:"openshift_cloud_network_config_controller_cloud_credentials_policy"` - ClusterCSI types.String `tfsdk:"openshift_cluster_csi_drivers_ebs_cloud_credentials_policy"` - ImageRegistry types.String `tfsdk:"openshift_image_registry_installer_cloud_credentials_policy"` - IngressOperator types.String `tfsdk:"openshift_ingress_operator_cloud_credentials_policy"` - MachineAPI types.String `tfsdk:"openshift_machine_api_aws_cloud_credentials_policy"` + CloudCred types.String `tfsdk:"openshift_cloud_credential_operator_cloud_credential_operator_iam_ro_creds_policy"` + CloudNetwork types.String `tfsdk:"openshift_cloud_network_config_controller_cloud_credentials_policy"` + ClusterCSI types.String `tfsdk:"openshift_cluster_csi_drivers_ebs_cloud_credentials_policy"` + ImageRegistry types.String `tfsdk:"openshift_image_registry_installer_cloud_credentials_policy"` + IngressOperator types.String `tfsdk:"openshift_ingress_operator_cloud_credentials_policy"` + SharedVpcIngressOperator types.String `tfsdk:"shared_vpc_openshift_ingress_operator_cloud_credentials_policy"` + MachineAPI types.String `tfsdk:"openshift_machine_api_aws_cloud_credentials_policy"` } type AccountRolePolicies struct {