Skip to content

Commit

Permalink
OCM-3210: ocm_policies_data_source also expose shared vpc operator po…
Browse files Browse the repository at this point in the history
…licy
  • Loading branch information
nirarg authored and openshift-merge-robot committed Sep 13, 2023
1 parent 907f30a commit eb05ecb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
19 changes: 13 additions & 6 deletions provider/ocm_policies_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions provider/ocm_policies_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit eb05ecb

Please sign in to comment.